[Qt-interest] QXmlStreamWriter not adding encoding attribute.
JD Guzman
lostinthecode at googlemail.com
Thu May 19 22:22:08 CEST 2011
Thanks everyone for your responses. It's probably my fault but the documentation on QXmlStreamWriter seemed rather vague on this front. Reading through it, I interpreted it as saying that UTF-8 was used by default in all cases unless changed explicitly. It also made it seem that encoding is always presented in the end result.
In the end I switched to QByteArray and all is good. The consumer for this particular piece of xml has to have the encoding attribute set otherwise I wouldn't have really cared.
Regards,
JD
On 17 May 2011, at 08:37, Thiago Macieira wrote:
> On Tuesday, 17 de May de 2011 09:00:30 Andreas Pakulat wrote:
>> Why not? If you look into the XML standard you'll notice that no
>> encoding attribute means the encoding of the file has to be utf-8. So
>> adding an explicit encoding attribute that states this would be
>> redundant.
>>
>> If you change the encoding to something other than utf-8 the writer
>> should add the encoding attribute.
>
> Andreas is technically right, of course.
>
> But his answer is not the reason for the missing encoding. The encoding is
> missing because the XML was saved to a QString, for which the encoding is
> specified by construction: UTF-16.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Senior Product Manager - Nokia, Qt Development Frameworks
> PGP/GPG: 0x6EF45358; fingerprint:
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list