[Development] HEADS-UP: QStringLiteral

Lars Knoll lars.knoll at qt.io
Mon Aug 26 18:20:49 CEST 2019


> On 26 Aug 2019, at 07:53, Thiago Macieira <thiago.macieira at intel.com> wrote:
> 
> On Monday, 26 August 2019 05:02:28 PDT Lars Knoll wrote:
>>> And we've done that and all of Qt's modules build like that.
>> 
>> Really? It’s probably what happens in practice in most cases on Linux and
>> macOS, as their locale is utf-8, but we do not force the input encoding to
>> anything as far as I can tell. There’s no -finput-charset=utf-8 anywhere in
>> Qt’s sources. That implies that gcc will try to pick up the input charset
>> from the locale.
> 
> GCC and Clang default to UTF-8 *unless* you pass -finput-charset to something 
> different, independent of what your locale is.

That wasn’t how I understood it. Here’s the corresponding man page entry from gcc:

-finput-charset=charset
        Set the input character set, used for translation from the character set of the input file to the source character set used by GCC.  If the locale does not specify, or GCC cannot get
           this information from the locale, the default is UTF-8.  This can be overridden by either the locale or this command-line option.  Currently the command-line option takes precedence if
           there's a conflict.  charset can be any encoding supported by the system's "iconv" library routine.

I’m happy to be proven wrong, but to me this sounds like it’s getting the file encoding from the locale, if that one specifies a charset.

Cheers,
Lars



More information about the Development mailing list