Answered by:
Console.writeline doesnt display chinese character in english os,help

Question
-
my code is really simple, just one line: Console.WriteLine("中文");
and in my computer(chinese os) is ok. but in english version os, it display "??"
i try to set the Console.OutputEncoding= Encoding.UTF8,and it displays irrecognizable characters.
i check the control panel of the english os, and the language for non-unicode program is english(united states), and the system default encoding is 1252 western european<windows>.
and i can type chinese character in my explorer search bar. file name can be chinese, even my another program which will write some chinese characters to some file is ok as well.
so i really confuse, why is console not displaying my string correctly.Thursday, September 24, 2009 6:21 PM
Answers
-
Console mode programs are stuck with non-Unicode support. Necessarily so because their output can be redirected. They're not going to display Chinese characters properly unless the system code page is Chinese.
The other programs you used that properly supported your Chinese input are Unicode enabled. Which is the way to get ahead, write a real Windows program instead of console mode apps. It isn't hard with Windows Forms.
Hans Passant.Thursday, September 24, 2009 8:13 PM
All replies
-
Ensure the culture is chinese.
See http://www.csharp-examples.net/culture-names/
John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.comThursday, September 24, 2009 6:24 PM -
Also see
How to display Chinese Characters in a C# Application
John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.comThursday, September 24, 2009 6:58 PM -
Console mode programs are stuck with non-Unicode support. Necessarily so because their output can be redirected. They're not going to display Chinese characters properly unless the system code page is Chinese.
The other programs you used that properly supported your Chinese input are Unicode enabled. Which is the way to get ahead, write a real Windows program instead of console mode apps. It isn't hard with Windows Forms.
Hans Passant.Thursday, September 24, 2009 8:13 PM -
see this link, setting this way also works on CMD
if your cmd can show chinese, your console can show chinese
https://www.walkernews.net/2013/05/19/how-to-get-windows-command-prompt-displays-chinese-characters/
- Edited by www3000 Tuesday, April 24, 2018 1:46 AM
Tuesday, April 24, 2018 1:43 AM