How to make Unicode charset in cmd.exe by default?
WindowsUnicodeCharacter EncodingCmdConsoleWindows Problem Overview
866 charset installed by default in Windows' cmd.exe is poor and inconvinient as compared with glorious Unicode.
Can I install Unicode by default or replace cmd.exe to another console and make it default so programms use it instead of cmd.exe?
I understand that chcp 65001 changes encoding only in the running console. I want to change charset at the system level.
Windows Solutions
Solution 1 - Windows
After I tried algirdas' solution, my Windows crashed (Win 7 Pro 64bit) so I decided to try a different solution:
- Start
Run
(Win+R) - Type
cmd /K chcp 65001
You will get mostly what you want. To start it from the taskbar or anywhere else, make a shortcut (you can name it cmd.unicode.exe
or whatever you like) and change its Target
to C:\Windows\System32\cmd.exe /K chcp 65001
.
Solution 2 - Windows
Open an elevated Command Prompt (run cmd as administrator). query your registry for available TT fonts to the console by:
REG query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont"
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 TT 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 "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont" /v 000 /t REG_SZ /d "Courier New"
Now we implement UTF-8 support:
REG ADD HKCU\Console /v CodePage /t REG_DWORD /d 65001 /f
Set default font to "Courier New":
REG ADD HKCU\Console /v FaceName /t REG_SZ /d "Courier New" /f
Set font size to 20 :
REG ADD HKCU\Console /v FontSize /t REG_DWORD /d 20 /f
Enable quick edit if you like :
REG ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f
Solution 3 - Windows
Save the following into a file with ".reg" suffix:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe]
"CodePage"=dword:0000fde9
Double click this file, and regedit will import it.
It basically sets the key HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe\CodePage
to 0xfde9 (65001 in decimal system).
Solution 4 - Windows
For me, for Visual Studio 2022, it worked when I executed this ".reg" command.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\C:_Program Files_Microsoft Visual Studio_2022_Professional_Common7_IDE_CommonExtensions_Platform_Debugger_VsDebugConsole.exe]
"CodePage"=dword:0000fde9
It is based on @Shaohua Li's answer: https://stackoverflow.com/a/24711864/2941313. It does the same thing but for different path (specifically for VS2022 console).