Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
995 views
in Technique[技术] by (71.8m points)

utf 8 - How to display japanese Kanji inside a cmd window under windows?

I have an english Windows 2003 server with asiatic language support activated. The two only fonts available for the command window (cmd settings) are raster and lucida console. Neither the one nor the other display the Kanji correctly (displayed as question mark).

Is there a solution to get them displayed? Is there some transformation I must do in my application before writing out to the console?

I am writing UTF8 out at the moment, what works well also for some non ASCII characters (like ??ü?). The source code writing to the console has the correct data (the Kanji can be viewed in the debugger correctly). If it matters, I am writing the app in C#.

EDIT: I found this link which explains the issues behind the problem and presents a solution (involving native calls) for C#. This shall work well with .NET 4.5 (untested by me)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you find a font that will display the Kanji character set, you can add that font to the cmd Settings by adding values under this Registry key:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionConsoleTrueTypeFont

Values:

Name: 00
Data: Consolas

I've done this before but found this reference on SuperUser: https://superuser.com/q/55318

Hope this helps


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...