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

Scott Bloom scott at towel42.com
Thu Dec 21 23:49:33 CET 2017


When using the QXmlStreamWriter to write out an XML file, where one of the sections is a DateTime Field, and the system is non-UTF8 (Japanese in my customer case) the XML generated via

writer.writeCharacters( dateTime.toString() )

Produces XML that cant be read in via QXmlStreamReader

Now, I am guessing, that I have to setup the writer with the proper codec via writer.setCodec( )

The problem is, how do I get the name of the codec properly?  QTExtCodec::codecForLocale returns "System".

How do I get the proper codec that will actually be needed to generate proper XML?

Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171221/49d911f4/attachment.html>


More information about the Interest mailing list