[Development] MSVC 2015 option /utf8: Qt only or everyone?

Thiago Macieira thiago.macieira at intel.com
Wed May 11 19:55:36 CEST 2016


On quarta-feira, 11 de maio de 2016 18:55:03 PDT André Pönitz wrote:
> > GCC and Clang on Unix systems already operate like this new MSVC
> > option. They do that irrespective of what your locale settings are:
> > sources are assumed to be UTF-8, period.
> 
> I don't see this for GCC 5.2.1 Linux for string literals, even with
> -Wall It pretty much looks like they are put 1:1 into the object files,
> no matter what the encoding is.

For narrow, non-Unicode character literals. Try that with the ones that do 
require transcoding and you'll see.

What's more, GCC assumes that the source is UTF-8, so it will not transform 
the u8"" string literals. That means that if your source is not what it is 
supposed to be, you'll produce invalid UTF-8 sequences.

> Clang issues a "warning: illegal character encoding in string
> literal", but it's a just warning that can be switched off.
> 
> Judging from the top 20 hits in my favourite search engine the feature
> is (a) controversial, and (b) there are still tons of 8-bit non-UTF8
> encoded sources around.

Indeed, and that's probably why GCC does not print a warning. But see if you 
find people complaining about the transcoding done for u, U and L literals.

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




More information about the Development mailing list