[Interest] Question about QTextStream and codecs

Thiago Macieira thiago.macieira at intel.com
Thu May 25 22:45:44 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.

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

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list