[Interest] Question about QTextStream and codecs

Murphy, Sean smurphy at walbro.com
Fri May 26 14:22:25 CEST 2017

> On Thursday, 25 May 2017 08:26:50 PDT Murphy, Sean wrote:
> > So I have it all working, I'm just trying to understand why the explicit
> > call to setCodec() was necessary on the writing end, but didn't appear to
> > be required on the input end?
> QTextStream defaults to::
> * codec: the locale's codec
> * autoDetectUnicode: true
> Obviously, the auto detection only works on *reading*. So my conclusion is:
> a) your system's locale is not UTF-8. If you're on any Unix system, you should
> check your settings. If you're on Windows, that's normal.

I am on Windows, sorry I forgot to mention that in the original post

> b) your input XML file has a UTF-8 BOM.

I don't think the input file has any BOM, unless my hex editor is playing tricks on me. Opening the input file in the hex editor the first byte shown is an 0x3c, which is the opening '<' of the first xml tag.

More information about the Interest mailing list