Is there a Windows command shell that will display Unicode characters?

Multi tool use
Multi tool use


Is there a Windows command shell that will display Unicode characters?



Assuming I have fonts installed which have the appropriate glyphs in them, is there a command shell for Windows XP that will display Unicode characters? At a minimum, two things that should display Unicode correctly:



Here's what I've tried so far:



No luck. I even tried installing custom fonts for cmd/PowerShell. PowerShell and cmd.exe seem to be Unicode-aware in the sense that I can copy/paste the non-printable box out of there and it will paste into other apps with the correct characters. Cygwin (?) seems to convert to the ? character and that comes through in the copy/paste.



Any ideas?




12 Answers
12



This was a major issue in PowerShell v1. Version 2 is shipping with a "graphical shell" that corrects the problem, which is ultimately not with PowerShell, but with the Windows console host (which Cmd.exe also uses). You can get the current CTP for PowerShell v2, if you want.



Actually, PowerShell v2.0 was finalized and shipped with the release of Windows 7 and Windows Server 2008 R2 in early August. In addition, the backported versions (Windows Vista/2008) reached their Release Candidate milestone just the other day; Windows XP/Windows Server 2003 should follow very shortly. Linky linky.





Upvoted for suggesting a working solution to the problem. I would accept it, except I'm holding out hope for something better. As "early alpha", it has a long way to go to be a truly usable shell.
– Brandon DuRette
Dec 18 '08 at 21:44





The current CTP3 is incredibly stable and, sadly, it's about the only solution out there these days that doesn't involve paying money.
– Don Jones
Dec 30 '08 at 14:58





Since this old topic got bumped to the top of the list recently, I edited the primary answer with a link to the latest Powershell bits.
– Richard Berg
Sep 19 '09 at 4:14





I don't understand. Where is this "graphical shell"? I'm using Windows 8.1, and invoking Powershell still appears to use the 1252 codepage (on my en-US laptop).
– Jason R. Coombs
Apr 20 '14 at 21:20





Powershell ISE is a graphical shell, it seems. It does popups with completions etc.
– sandos
Jan 14 '15 at 11:35



To do this with cmd.exe, you'll need to use the console properties dialog to switch to a Unicode TrueType font.



Then use these commands:


CHCP 65001
DIR > UTF8.TXT
TYPE UTF8.TXT



Commands:



The characters will still need to be supported by the font to display properly on the console.



I18N: Unicode at the Windows command prompt (C++; .Net; Java)





This is the right way to do it! Thx McDowell!
– Peter Parker
Dec 8 '10 at 17:06





According to stackoverflow.com/questions/14109024/… , CP 65001 does not solve all problems with Unicode support, so this is a flawed solution.
– ivan_pozdeev
Nov 11 '17 at 8:28



Setting the codepage to UTF-8 with the command "chcp 65001" should help you print file contents correctly to the shell (using cmd.exe). This won't work for directory listings though (UTF-16 encoding in NTFS file names).





Nice answer. This works in Powershell too.
– Jason R. Coombs
Apr 20 '14 at 21:22



Try this:


powershell.exe -NoExit /c "chcp.com 65001"



Who uses msysgit:


powershell.exe -NoExit /c "chcp.com 65001; sh --login -i"



Do not forget to change font of window to TrueType font with UTF-8 support ("Lucida Console")





This works well so that my utf8 chars are displayed correctly. Is there a way to make the powershell.exe configuration persistent (chcp.com 65001) so that it gets selected by default ?
– chmike
Aug 19 '14 at 14:28






cmd with the same as you configure, is also work use chcp 65001, then choose font Lucida console
– alljoyland
Aug 25 '14 at 16:34





I use msysgit in PowerShell with following configuration: gist.github.com/iegik/7485025
– iegik
Sep 5 '14 at 7:24




This is how I can got Chinese output in cmd.exe running on Windows 7 Pro English Version. I also tried file names with Japanese, Russian, and Polish and they all seem to display correctly. Input also seems to work, at least when I tried to do a dir xxx* containing non-ascii characters.


cmd.exe


dir xxx*



Install console2, which is a front-end to cmd.exe (and other shells)


cmd.exe



After installation, follow these instructions



Delete the key HKEY_CURRENT_USERConsoleConsole2 command window in the registry.


HKEY_CURRENT_USERConsoleConsole2 command window



Import the following data into windows registry:


Windows Registry Editor Version 5.00
[HKEY_CURRENT_USERConsoleConsole2 command window]
"CodePage"=dword:000003a8
"FontSize"=dword:000a0000
"FontFamily"=dword:00000036
"FontWeight"=dword:00000190
"FaceName"="細明體"
"HistoryNoDup"=dword:00000000



You may or may not have to change the font. Initially I had the font set to @NimSum, and the Chinese characters came out rotated 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 I'm not sure if you actually have to set the font or not.


@NimSum


NimSum


Consola



For a true shell, try PowerShell Plus. You can select Unicode fonts and work with other languages, not only in the editor, but in the true console.



Try Console 2. Be careful with the colors/palette configurations though. Those are a bit buggy. I have confirmed them to not work; they behave like cmd.exe.





On your suggestion, I tried it and it doesn't seem to solve my problem. Running 'dir' in a directory with files that have names that include Korean characters results in ?'s. This behavior is the same as cmd.exe.
– Brandon DuRette
Jan 8 '09 at 21:21





Ok. Console2 probably uses the Windows console host as well then, just with a nicer front end.
– Kim André Sand
Jan 9 '09 at 18:33



PowerShell V2 CTP3 inside Console2 seems to do that. The only downside is that the default console encoding is UCS-2 LE instead of UTF-8.



As of November 2011, MinTTY is now Cygwin's default terminal emulator (installed by setup.exe). MinTTY is a fork of PuTTY's terminal emulator, and as such sports proper Unicode support and much-improved compatibility with other terminal emulators.


setup.exe



Open an elevated command prompt (run cmd as administrator). Query your registry for available TrueType fonts to the console by:


REG query "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionConsoleTrueTypeFont"



You'll see an output like:


0 REG_SZ Lucida Console
00 REG_SZ Consolas
936 REG_SZ *新宋体
932 REG_SZ *MS ゴシック



Now we need to add a TrueType font that supports the characters you need like Courier New, we do this by adding zeros to the string name, so in this case the next one would be "000" :


REG ADD "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionConsoleTrueTypeFont" /v 000 /t REG_SZ /d "Courier New"



Now we implement UTF-8 support:


REG ADD HKCUConsole /v CodePage /t REG_DWORD /d 65001 /f



Set default font to "Courier New":


REG ADD HKCUConsole /v FaceName /t REG_SZ /d "Courier New" /f



Set font size to 20 :


REG ADD HKCUConsole /v FontSize /t REG_DWORD /d 20 /f



Enable quick edit if you like :


REG ADD HKCUConsole /v QuickEdit /t REG_DWORD /d 1 /f



Also from
UTF-16 on cmd.exe


Open/run cmd.exe
Click on the icon at the top-left corner
Select properties
Then "Font" bar
Select "Lucida Console" and OK.
Write Chcp 10000 at the prompt
Finally dir /b





10000 is not a Unicode codepage and it can not displays characters outside Mac Roman charset
– phuclv
Jun 10 '14 at 9:59



A fast and convenient way to do it is on the Explorer.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

TLB4 dzYvU R8 5ZuexS kANXG1Oas,lgDJV6qvtXUWOv,06ov4aWt,6Mv upMa2gLF2,w6OF95e9,rXfFCawv03VYl5W
B,5mKkpgPflGwXBpu

Popular posts from this blog

PySpark - SparkContext: Error initializing SparkContext File does not exist

django NoReverseMatch Exception

List of Kim Possible characters