On quinta-feira, 21 de dezembro de 2017 20:49:33 -02 Scott Bloom wrote: > 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
What is your Writer writing to? If it's a QIODevice or QByteArray, then it does this: QByteArray bytes = encoder->fromUnicode(s); device->write(bytes) If it's a string, it does: stringDevice->append(s); (this is after escaping) What is the XML it generates? We need to isolate the problem either in the Writer or in the Reader. > Now, I am guessing, that I have to setup the writer with the proper codec > via writer.setCodec( ) No need, as the default is UTF-8. > How do I get the proper codec that will actually be needed to generate > proper XML? Ask for the codec for "UTF-8". Which is what QXmlStreamWriter is already doing. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest