Utf 8 - How To Display Japanese Kanji Inside A CMD Window Under Windows - Stack Overflow
Utf 8 - How To Display Japanese Kanji Inside A CMD Window Under Windows - Stack Overflow
- Stack Overflow
The 2024 Developer Survey results are live! See the results
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
20 one nor the other display the Kanji correctly (displayed as question mark).
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)
Share Improve this question Follow edited May 4, 2012 at 21:08 asked Sep 23, 2010 at 16:14
Comic Sans MS Lover jdehaan
1,729 5 26 52 19.9k 6 61 98
1 Translation: "Select Japanese in the control panel instead of another code page" (I suppose it is in the
default language for non unicode programs tab). – jdehaan Sep 24, 2010 at 6:55
1 @ring0, This indeed works! I have a yen symbol instead of backslashes, like on the Japanese systems I work
on. The Kanjis are displayed now. Only negative point the fixed fonts are quite ugly for plain english, but
ok, it works. Start -> Control Panel -> Regional and Language Options -> Advanced -> Language for non-
Unicode programs -> Japanese... – jdehaan Sep 24, 2010 at 7:05
https://stackoverflow.com/questions/3780378/how-to-display-japanese-kanji-inside-a-cmd-window-under-windows# 1/6
8/1/24, 7:06 AM utf 8 - How to display japanese Kanji inside a cmd window under windows? - Stack Overflow
Report this ad
Sorted by:
5 Answers
Highest score (default)
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:
9
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont\
Values:
Name: 00
Data: Consolas
I've done this before but found this reference on SuperUser: https://superuser.com/q/55318
Share Improve this answer Follow edited Mar 20, 2017 at 10:18 answered Sep 23, 2010 at 16:29
Community Bot paludarium
1 1 190 2
1 Good tip. Unfortunately it didn't work out for me and the Kanjis. Note that it only fixed fonts like "Courier
New" appear in the selection for the console. Setting not fixed fonts in the registry has no effect. I think it
is maybe due to some links in the fonts. In the case of "Arial Unicode MS" it switched to "Mincho" in the
character map when I select the Kanji range... Strange stuff :-) – jdehaan Sep 24, 2010 at 6:52
On the one machine Consolas was not available. I tested on another one and this font seems really to work
well. Just the legal impact on the font use (reserved for VS Studio licensees) is a bit problematic... At least
on the development machine It works. I just have to find a free font that does the same. – jdehaan Sep
24 2010 t 9 20
https://stackoverflow.com/questions/3780378/how-to-display-japanese-kanji-inside-a-cmd-window-under-windows# 2/6
8/1/24, 7:06 AM utf 8 - How to display japanese Kanji inside a cmd window under windows? - Stack Overflow
24, 2010 at 9:20
HKEY_CURRENT_USER\Console also provides interesting tweaking possibilities – jdehaan Sep 24, 2010 at
10:19
3 It really turns out that despite right encoding, the console could not always display the chars correctly
(ending with boxes or interrogation marks) depending on the font used. So the font setting is essential for
the stuff to work properly. – jdehaan Sep 24, 2010 at 10:24
3 I don't see how this answers the question. What's "Name: 00 Data: Consolas"? Why is this the accepted
answer? – Nikolai Mar 8, 2015 at 16:16
How is your application writing output? The C byte-based stdio calls like printf won't support
UTF-8 on Windows unless you have specifically set the console to use UTF-8 encoding by saying
6 chcp 65001 && somecommand (and even then there are problems).
Without chcp , the console will be using the Windows installation's default code page, in this case
cp1252, and writing in kanji will be impossible even if the console font you're using has glyphs
for it.
If you want to write Unicode to the console reliably you would have to use character-based
interfaces like wprintf .
Share Improve this answer Follow answered Sep 23, 2010 at 17:41
bobince
534k 109 665 840
+1, thanks for this hint too, it seems indeed to be a codepage issue in the end. I thought cmd.exe was a
unicode program but actually it appears not to be. The things that can be tuned in the registry (see answer
from paludarium) show how to bind the codepage to the actual used font... I begin to see light at the end
of the tunnel! – jdehaan Sep 24, 2010 at 8:03
4 cmd.exe can display Unicode characters, but only if the process it is running passes it Unicode, via
wprintf or Win32 WriteConsoleW . Most command-line software, however, uses the C stdio byte-based
output functions like printf , so you'll be limited by the codepage. It is very unfortunate that on Windows
the system default codepage can never be 65001 (UTF-8), and that there are some serious bugs with
setting chcp 65001 at all. Every other OS has standardised on UTF-8, allowing any old byte-based
console app to do something sensible with Unicode. – bobince Sep 24, 2010 at 8:24
Console.OutputEncoding = Encoding.UTF8; AND setting the font to "Consolas" works out. However I
get weird errors on the font size when I go to the console font configuration again... – jdehaan Sep 24,
2010 at 9:12
I hope you don't mind too much I accorded the accept to paludarium. Actually both combined answers are
correct, but I had to make a choice. I've chosen the one with the lesser SO score. – jdehaan Sep 24, 2010
at 10:22
This is how I can got Chinese input/output in cmd.exe running on Windows 7 Pro English Version.
https://stackoverflow.com/questions/3780378/how-to-display-japanese-kanji-inside-a-cmd-window-under-windows# 3/6
8/1/24, 7:06 AM utf 8 - How to display japanese Kanji inside a cmd window under windows? - Stack Overflow
3. You may or may not have to change the font. Initially I had the font set to @NimSum, and
the Chinese characters came out rotate 90 degrees. Then I switched to NimSum (without the
@) and it came out correctly. Then just out of curiosity I switched to Consola and yet I can
still see the Chinese Characters. So not sure if you actually have to set the font or not.
Share Improve this answer Follow edited Apr 18, 2013 at 16:44 answered Apr 28, 2012 at 0:27
Cody Gray - on strike ♦ crusherjoe
243k 51 497 578 31 1
HKEY_Current_User → Console, console2 command window did not appear there, apparentely you right
click on Console, and then import key, I guess. – gimmegimme Aug 2, 2022 at 1:51
Consolas (even on Windows 10) does not display Japanese characters correctly in a console; I
checked the font in Character Map and it simply doesn't have glyphs for any SE Asian languages.
1 You need to set your console font to MS Mincho or a similar Asian-supporting font to show
Japanese characters. This will also change backslashes to yen symbols which is a standard thing
on Japanese systems. You don't need to change your code page or locale settings, but you will
need to at least install Japanese language support to get the Japanese fonts installed. On NT5
https://stackoverflow.com/questions/3780378/how-to-display-japanese-kanji-inside-a-cmd-window-under-windows# 4/6
8/1/24, 7:06 AM utf 8 - How to display japanese Kanji inside a cmd window under windows? - Stack Overflow
systems like Windows Server 2003 and Windows XP, there's a checkbox somewhere in the
regional and language options for it; on NT6 (Vista and later) you can just add the Japanese IME
and it'll install the required files.
My preferred setup:
chcp 65001
cmd
Press OK
Your command line should now, by default, be able to print Japanese characters correctly.
Additional Notes:
MS Mincho should be installed by default on Modern Windows OSes. However, I've come across
some systems that did not have it installed. When this happens, I download and install (simply by
double clicking on the font) from here:
https://fontzone.net/font-download/ms-mincho
Share Improve this answer Follow edited Jul 13 at 8:31 answered Jul 13 at 8:16
James John McGuire
'Jahmic'
12 4k 11 72 81
https://stackoverflow.com/questions/3780378/how-to-display-japanese-kanji-inside-a-cmd-window-under-windows# 5/6
8/1/24, 7:06 AM utf 8 - How to display japanese Kanji inside a cmd window under windows? - Stack Overflow
12.4k 11 72 81
https://stackoverflow.com/questions/3780378/how-to-display-japanese-kanji-inside-a-cmd-window-under-windows# 6/6