|
-
December 27th, 2005, 01:03 AM
#1
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!
-
December 27th, 2005, 03:30 AM
#2
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.....
-
December 27th, 2005, 03:51 AM
#3
Re: wprintf doesnot print Chinese character
If I Helped You, "Rate This Post"
Thanks
Guna
-
December 27th, 2005, 05:09 AM
#4
Re: wprintf doesnot print Chinese character
 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.
Last edited by zhang_shuigang; December 27th, 2005 at 05:11 AM.
-
December 27th, 2005, 05:12 AM
#5
Re: wprintf doesnot print Chinese character
 Originally Posted by Gunaamirthavelu
Thanks.
Sorry.I still have no idea what is wrong.
-
December 27th, 2005, 05:37 AM
#6
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.
-
December 27th, 2005, 09:09 AM
#7
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.
-
December 28th, 2005, 05:43 AM
#8
Re: wprintf doesnot print Chinese character
 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!
-
December 28th, 2005, 06:30 AM
#9
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.
-
December 28th, 2005, 07:19 AM
#10
Re: wprintf doesnot print Chinese character
 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.
-
January 17th, 2006, 12:09 AM
#11
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!
-
January 18th, 2006, 12:56 PM
#12
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|