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

2012-06-09 Thread 1+1=2
On Sat, Jun 9, 2012 at 1:54 AM, Thiago Macieira wrote: > On sábado, 9 de junho de 2012 01.42.21, 1+1=2 wrote: >> > Do we need this for every file, or is one entry in qglobal.h enough? >> >> One entry in qglobal.h is enough. > > It's also weird. The option should be the input charset, not the execu

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

2012-06-09 Thread Thiago Macieira
On sábado, 9 de junho de 2012 01.42.21, 1+1=2 wrote: > > Do we need this for every file, or is one entry in qglobal.h enough? > > One entry in qglobal.h is enough. It's also weird. The option should be the input charset, not the execution charset. -- Thiago Macieira - thiago.macieira (AT) intel.c

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

2012-06-09 Thread 1+1=2
On Fri, Jun 8, 2012 at 1:15 AM, wrote: > Do we need this for every file, or is one entry in qglobal.h enough? > One entry in qglobal.h is 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.

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

2012-06-08 Thread lars.knoll
On 6/7/12 9:27 PM, "ext Thiago Macieira" 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 fil

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

2012-06-07 Thread 1+1=2
Yes, MinGW works well, the default input-char-set of which is UTF-8 ,no matter whether BOM exists or not. The behavior is the same as GCC under linux. Debao On Thu, Jun 7, 2012 at 12:52 PM, Konstantin Ritt wrote: > #g++ -std=c++0x len.cpp > #a.exe >> It's quite good > > both gcc-4.4.0 and gcc-4.

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

2012-06-07 Thread Konstantin Ritt
#g++ -std=c++0x len.cpp #a.exe > It's quite good both gcc-4.4.0 and gcc-4.6.2, MinGW32 Regards, Konstantin 2012/6/7 Jürgen Hunold : > Hi Thiago, > > On Thursday, 7. June 2012 21:27:29 Thiago Macieira wrote: >> Anyway, MSVC is now on my list of "crap". I wonder what MinGW is doing on >> Windows.

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

2012-06-07 Thread Jürgen Hunold
Hi Thiago, On Thursday, 7. June 2012 21:27:29 Thiago Macieira wrote: > 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. E:\Home\hunold\src\tes

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

2012-06-07 Thread Thiago Macieira
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_

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

2012-06-07 Thread 1+1=2
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")" This is not bad for Chinese users. Let's see what happened:

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

2012-06-07 Thread Thiago Macieira
On domingo, 22 de abril de 2012 12.49.59, Thiago Macieira wrote: > So the solution to make everything work is: > 1) always use UTF-8 encoded files > 2) mark your US-ASCII strings with QLatin1String > 3) everything else will either auto-convert, or use QString::fromUtf8 or > QStringLiteral >

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

2012-04-23 Thread Thiago Macieira
On domingo, 22 de abril de 2012 12.49.59, Thiago Macieira wrote: > I'd like to point out that the change is not complete. Update: I'm trying to complete the change now: https://codereview.qt-project.org/#q,project:qt/qtbase+branch:qstring-utf8,n,z -- Thiago Macieira - thiago.macieira (AT) intel.c

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

2012-04-22 Thread Loaden
Found in here: http://lists.qt-project.org/pipermail/development/2012-April/003391.html Thanks again! 2012/4/23 Loaden > Thiago Macieira has already answered your question. ;-) > > I does't receive the email from Thiago Macieira. &&&>***? any thing wrong? > I am use gmail from web browser. > Do

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

2012-04-22 Thread Loaden
> > Thiago Macieira has already answered your question. ;-) I does't receive the email from Thiago Macieira. &&&>***? any thing wrong? I am use gmail from web browser. Does anyone could post the mail to me again? thanks!!! 2012/4/23 1+1=2 > Thiago Macieira has already answered your question. ;-

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

2012-04-22 Thread 1+1=2
Thiago Macieira has already answered your question. ;-) On Sun, Apr 22, 2012 at 6:00 PM, Loaden wrote: >> Seems you still use two different sets of source code. > The current question is: Shall we need or no-need to use UTF-8 encoding as > default? > I thought we should use UTF-8 as default, Be

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

2012-04-22 Thread Loaden
To clear for my previous post. Under Linux + GCC4.6.x, We can use UTF-8 BOM in *source* files, not in *header* files. So if use UTF-8 encoding and with BOM, the source file should can cross-platform. In Creator, see https://codereview.qt-project.org/11851 It's easy to add/delete UTF-8 BOM now. 201

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

2012-04-22 Thread Loaden
> > Seems you still use two different sets of source code. > * Under MSVC 2010, source files saved as UTF8 with BOM. > * Under Linux GCC, source files saved as UTF8 without BOM. No, Under Linux GCC, the source files saved as UTF-8 *with* BOM too. It's works fine when it's Windows either Linux. S

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

2012-04-22 Thread 1+1=2
IMO, codecForXXX() is really a good news for China users. In the past three years, I noticed that too many newcomers using these functions in a wrong way. such as {{{ QTextCodec *codec = QTextCodec::codecForName("System"); QTextCodec::setCodecForLocale(codec); QTextCodec::setCodecForCStrings(cod

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

2012-04-22 Thread 1+1=2
Hi Loaden, Seems you still use two different sets of source code. * Under MSVC 2010, source files saved as UTF8 with BOM. * Under Linux GCC, source files saved as UTF8 without BOM. which means your application is not corss-platform. And of course, this is a defect of C++ instead of Qt. You sh

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

2012-04-22 Thread 1+1=2
Hi Loden, The source code you provided if not cross-platform even under Qt4. Under Windows platform, source file is save using encoding "GBK" while under linux platform it saved as "UTF-8" which means you are using two sets of source code for two platforms. In addition, these are two errors(mis

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

2012-04-22 Thread Thiago Macieira
On domingo, 22 de abril de 2012 22.54.14, Loaden wrote: > > There has also been talk about making QString's char* methods use to > > utf8 (meaning you'd be able to use QString foo("bunçh øf u†f8 here"); > > and it'd work fine, but I never got around to writing that, I don't > > know if anyone else

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

2012-04-22 Thread Loaden
> > There has also been talk about making QString's char* methods use to > utf8 (meaning you'd be able to use QString foo("bunçh øf u†f8 here"); > and it'd work fine, but I never got around to writing that, I don't > know if anyone else has started yet. Sorry for my poor english. I just full under

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

2012-04-22 Thread Loaden
Thanks for help!! I just test on Windows 7 (MSVC2010) and Linux (GCC 4.6.2), both (Win / Linux, Qt4 / Qt5) works well use below code. > #include > #include > #include > int main(int argc, char *argv[]) > { > #ifdef Q_CC_MSVC > #pragma execution_character_set("UTF-8") > #endif > QAppli

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

2012-04-22 Thread Giuseppe D'Angelo
On 22 April 2012 11:50, Loaden wrote: >>  (I don't have any clue about MSVC). > > That the point! In current solution, It's does't work for this case if use > MSVC Compiler. > My Point: > Please don't think about of MSVC users. > Or, please give me a way to fix the problem. I don't know. If that

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

2012-04-22 Thread Robin Burchell
2012/4/22 Thiago Macieira : > Any compiler or text editor that can't understand UTF-8 (without a BOM) will > receive from me the label of "crap" and will not take into consideration the > problems users using them have with the plan above. Well, they'd also be able to use QTextCodec directly to ac

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

2012-04-22 Thread Robin Burchell
On Sun, Apr 22, 2012 at 11:55 AM, Giuseppe D'Angelo wrote: > You can do that -- as I said in my link, that requires that the > compiler emits UTF-8 as the execution charset for that literal. MSVC apparently has a bug here, but it is possible to do (with a workaround); http://support.microsoft.com

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

2012-04-22 Thread Loaden
After test, I can sure this code can works well on Windows 32bit + MSVC2010 or Linux 64bit + GCC4.6.2 with Qt4. But can't work with Qt5. Please give me a sulution about this case. > > #include > #include > #include > #include > #include > > int main(int argc, char *argv[]) > { > #ifdef Q_WS_W

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

2012-04-22 Thread Loaden
> > (I don't have any clue about MSVC). > That the point! In current solution, It's does't work for this case if use MSVC Compiler. My Point: Please don't think about of MSVC users. Or, please give me a way to fix the problem. 2012/4/22 Giuseppe D'Angelo > You can do that -- as I said in my link

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

2012-04-22 Thread Thiago Macieira
On domingo, 22 de abril de 2012 17.11.13, Loaden wrote: > Thanks for reply! I don't care the reason now, I just want know how to make > it work. > I am try UTF-8 of the source file, with or not with UTF-8 BOM, and try > fromLatin1/Utf8/Ascii too. > And all tried is failed! I'd like to point out th

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

2012-04-22 Thread Giuseppe D'Angelo
On 22 April 2012 10:36, Loaden wrote: > The question is: I don't want use utf-8 code in source files, like this: >> >> QString str = QString::fromUtf8("\xc3\xb7"); > > > I just want directly use the "÷" in source file. And I don't need know what > is the utf-8 code of "÷". Like this: >> >> QString

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

2012-04-22 Thread Loaden
The question is: I don't want use utf-8 code in source files, like this: > QString str = > QString > ::fromUtf8("\xc3\xb7"); I just want directly use the "÷" in source file. And I don't need know what is the utf-8

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

2012-04-22 Thread Giuseppe D'Angelo
2012/4/22 Loaden : > Thanks for reply! I don't care the reason now, I just want know how to make > it work. > I am try UTF-8 of the source file, with or not with UTF-8 BOM, and try > fromLatin1/Utf8/Ascii too. > And all tried is failed! > > In MSVC2010, If use some Chinese (CJK) strings, We have to

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

2012-04-22 Thread Loaden
Thanks for reply! I don't care the reason now, I just want know how to make it work. I am try UTF-8 of the source file, with or not with UTF-8 BOM, and try fromLatin1/Utf8/Ascii too. And all tried is failed! In MSVC2010, If use some Chinese (CJK) strings, We have to save the source file as UTF-8 w

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

2012-04-22 Thread Robin Burchell
2012/4/22 Loaden : > Hi, All! I am only a physics teacher from China.  It makes me confused  that > I just noticed the codecFor... function is removed for now. It's removed primarily for sanity reasons. Not being able to reliably know what fromAscii/toAscii are actually going to do mean that they

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

2012-04-22 Thread Loaden
Hi, All! I am only a physics teacher from China. It makes me confused that I just noticed the codecFor... function is removed for now. See: https://codereview.qt-project.org/#change,14626 https://codereview.qt-project.org/#change,14999 But please let's me know how to make this work with **MSVC20