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
#include <stdio.h> int main() { bool crap = sizeof(u"Résumé") != 14; puts(crap ? "It's crap" : "It's quite good"); }
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development