[Interest] QDateTime + QXmlStreamWriter on non-UTF8 compatible systems

Thiago Macieira thiago.macieira at intel.com
Tue Dec 26 13:20:53 CET 2017


On terça-feira, 26 de dezembro de 2017 10:01:58 -02 Scott Bloom wrote:
> When someone who has been an active user of Qt for 15+ years, says there is
> something fundamentally missing from the documentation.  

I did not dispute that. Yes, there is something missing from the documentation 
and it needs to be improved. I wholeheatedly agree with you there.

I am also saying there's a bug somewhere else in your code or in Qt. The 
problem is not the Writer, but the transformations you made before sending the 
information to the reader or the Reader itself.

> void QXmlStreamWriter::​setCodec(QTextCodec * codec)
> Sets the codec for this stream to codec. The codec is used for encoding any
> data that is written. By default, QXmlStreamWriter uses UTF-8.
 
> The encoding information is stored in the initial xml tag which gets written
> when you call writeStartDocument(). Call this function before calling
> writeStartDocument().
 
> If the documentation said: Note, when using a QString as a target, the codec
> setting is ignored.  Since QString is always UTF-16.
 
> Then I would never had asked any question to the mailing list.

I'll add that. See https://codereview.qt-project.org/215337

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list