[Development] Why we *have to* remove codecFor... ?

lars.knoll at nokia.com lars.knoll at nokia.com
Fri Jun 8 10:15:23 CEST 2012



On 6/7/12 9:27 PM, "ext Thiago Macieira" <thiago.macieira at intel.com> wrote:

>On quinta-feira, 7 de junho de 2012 11.09.52, 1+1=2 wrote:
>> Hi Thiago,
>> 
>> The real problem is caused by MSVC2005, as they can't generate UTF-8
>> exec-charset.
>> 
>> >From MSVC2010-SP1, they provided a workaround for this:
>> 1) Source file saved with BOM
>> 2) contains "#pragma execution_character_set("utf-8")"
>
>I'd prefer UTF-8 with no BOM, no #pragma, no special compiler option.
>
>But I suppose that a #pragma would help, though. That's exactly what I
>wanted 
>the C++ committee to have standardised, so we could properly exchange
>files 
>with a fixed encoding and not worry about the receiver's locale or
>compiler 
>options.
>
>> But now, If we using MSVC2010-Sp1 and GCC 4.6, Source files contains
>> non-ascii can be used in a cross-platform way. What we need is:
>> 1). Source files saved with BOM (supported by GCC too.)
>
>GCC does not support BOMs in headers.
>
>> 2). Add following lines:
>> 
>> #if _MSC_VER >= 1600
>> #pragma execution_character_set("utf-8")
>> #endif
>
>That's probably the acceptable workaround.

Do we need this for every file, or is one entry in qglobal.h enough?

As another solution, are there any compiler flags one can set to tell MSVC
about the input encoding? If yes, we can simply add that to the qmake.conf
for msvc.

Cheers,
Lars

>
>Anyway, MSVC is now on my list of "crap". I wonder what MinGW is doing on
>Windows.
>
>Can anyone save the (UTF-8 encoded) attached source file and run it?
>Don't 
>forget to compile with -std=c++0x.
>
>-- 
>Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel Open Source Technology Center
>     Intel Sweden AB - Registration Number: 556189-6027
>     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
>_______________________________________________
>Development mailing list
>Development at qt-project.org
>http://lists.qt-project.org/mailman/listinfo/development




More information about the Development mailing list