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

Thiago Macieira thiago.macieira at intel.com
Thu Jun 7 21:27:29 CEST 2012


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.

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: len.cpp
Type: text/x-c++src
Size: 127 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120607/4d8a6622/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120607/4d8a6622/attachment.sig>


More information about the Development mailing list