[Interest] QDateTime + QXmlStreamWriter on non-UTF8 compatible systems
Thiago Macieira
thiago.macieira at intel.com
Tue Dec 26 15:28:55 CET 2017
On terça-feira, 26 de dezembro de 2017 11:48:01 -02 Scott Bloom wrote:
> I would add a note along the lines, of "see setCodec" for the
> QXmlStreamWriter( QString * ) constructor.
I'll update.
> As to the bug, it was clear (once I understood the issue at hand) that
> writing to a QString and then writing the QString to a QFile via
> QTextStream was the wrong approach. Since the final destination being 8
> bit, would be never be thought of in the writer. The purpose was to enable
> easy unit testing that didn’t required file IO.
Ah, I see. So the problem is writing with QTextStream then reading directly
with QXmlStreamReader. Unlike QXmlStream{Reader,Writer}, which default to
UTF-8 as per XML definitions, QTextStream defaults to the locale codec.
If you had used QTextStream on the input and passed that to QXmlStreamReader,
it would have worked too.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Interest
mailing list