On sexta-feira, 22 de dezembro de 2017 17:21:24 -02 Scott Bloom wrote: > I was able to track down the issue. > > Typically, I was writing to a QString, for some reason, there is an > undocumented difference in the writer for QString vs QIODevice writing.
It's not really undocumented. QString is UTF-16, so it requires no encoding. QIODevice is 8-bit, so it encodes. > From QXmlStreamWriter::writeStartDocument > > if (d->device) { // stringDevice does not get any encoding > d->write("\" encoding=\""); > #ifdef QT_NO_TEXTCODEC > d->write("iso-8859-1"); > #else > d->write(d->codec->name().constData(), d->codec->name().length()); > #endif > } > > The codec was not getting written out since I was using a QString, by > changing to a QBuffer, the encoding is written out, and the XML can be read > in properly. Again, as expected. > Note, according to the documentation there is NO differentiation of "String > based" vs "Non String based" void QXmlStreamWriter::writeStartDocument() > This is an overloaded function. Right. > Frankly, I am not sure why this difference exists, but it should definitely > be documented. There's no need for it. Your bug isn't here yet. -- 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