wprintf doesnot print Chinese character
When I include the following line of code in the main method,
--------------------------------
wprintf(L"China,in Chinese,is %s",L"中国");
--------------------------------
it compiles.
At run time,it prints: "China,in Chinese,is ".
But,I expect it prints : "China,in Chinese,is 中国".
When I compile and run the code in another computer,
it prints:"China,in Chinese,is 中国".
I cannot find any difference between IDE settings and source code.
I use WindowXP,visual studio .net 2003.
Is there anything I should check?
Thanks!
Re: wprintf doesnot print Chinese character
which OS u r using....???
From ur ques..it seems that it might be a problem of code page u are using.....
Re: wprintf doesnot print Chinese character
Re: wprintf doesnot print Chinese character
Quote:
Originally Posted by developerid
which OS u r using....???
From ur ques..it seems that it might be a problem of code page u are using.....
I am using Window XP professional.
All other softwares behave normally,they can show Chinese character correctly.
I have no idea what is wrong.
Re: wprintf doesnot print Chinese character
Quote:
Originally Posted by Gunaamirthavelu
Thanks.
Sorry.I still have no idea what is wrong.
Re: wprintf doesnot print Chinese character
try by using MultiByteToWideChar function to convert to unicode and on both the machine, check the value of first parameter(which is code page).
I think u might get the difference there.If the value of code page is different, than the value of codepage on m/c , on which it is not giving the correct output is wrong.
Re: wprintf doesnot print Chinese character
It is not clear whether the program is running at the command prompt (as a console application, or in a DOS box), or if is running as a Win32 application. In the first case, you should check the codepage. And in both case, you should check if correct font files are installed on the computers.
Re: wprintf doesnot print Chinese character
Quote:
Originally Posted by developerid
try by using MultiByteToWideChar function to convert to unicode and on both the machine, check the value of first parameter(which is code page).
I think u might get the difference there.If the value of code page is different, than the value of codepage on m/c , on which it is not giving the correct output is wrong.
Sorry,I am new to cpp.And the method MultiByteToWideChar is too complicated for me.Maybe I can try it after I am more familar with cpp.
Thanks anyway!
Re: wprintf doesnot print Chinese character
Hi
To Support Unicode, two things need to be done. In VC++, go to the project menu and choose settings. On the C++ tab chose the category General and add the Preprocessor Definition for _UNICODE *don’t forget the underscore* and REMOVE the _MBCS (multi-byte character set) definition. Second, under the Link tab choose the category Output and set the entry point symbol to wWinMainCRTStartup.
This is not a requirement to display in multi-lingual applications because by default _MBCS is defined.
plz, give the rank.
Re: wprintf doesnot print Chinese character
Quote:
Originally Posted by luckykiran
Hi
To Support Unicode, two things need to be done. In VC++, go to the project menu and choose settings. On the C++ tab chose the category General and add the Preprocessor Definition for _UNICODE *don’t forget the underscore* and REMOVE the _MBCS (multi-byte character set) definition. Second, under the Link tab choose the category Output and set the entry point symbol to wWinMainCRTStartup.
This is not a requirement to display in multi-lingual applications because by default _MBCS is defined.
plz, give the rank.
Huhu.
I define _UNICODE,and the problem is still there.
If I set the entry to to 'wWinMainCRTStartup',the compiler say it doesnot konw '_wWinMain@16'.
Besides,in my code,I use unicode character(L"...") and unicode print method(wprintf) explicitly,I donot think preprocessor is to be blamed.
Oo,maybe ...I have no idea.
Re: wprintf doesnot print Chinese character
I solved it.
In Control Panel->Regional and Language Options->Regional Options ,change setting to 'English(United States)'.
I donot know why.
Thanks for your help!
Re: wprintf doesnot print Chinese character
it's not solution.... problem is locale settings in CRT...
use:
setlocale(LC_ALL, ".OCP");
perhaps set chinnese code page instead of ".OCP" (oem code page)
---------------
HiddenGuru