chcp 65001
in the command prompt prior to use of any tools helps but is there any way to set is as default code page?Changing
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP
value to 65001
appear to make the system unable to boot in my case.Proposed change of
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Autorun
to @chcp 65001>nul
Batch file .bat
@ECHO OFF
REM change CHCP to UTF-8
CHCP 65001
CLS
Saved at C:\Windows\System32 as switch.bat. Create a link for cmd.exe on the desktop. In the properties of cmd, changed the destination to:
C:\Windows\System32\cmd.exe /k switch
Note that it will print
Active code page: 65001
to stdout. So if you are doing something like CHCP 65001 && mycommand.exe
then you'll get the codepage printed out at the start. You need to CHCP 65001 >nul && mycommand.exe
Reg file:
Command Prompt:
PowerShell:
Cygwin:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe]
"CodePage"=dword:fde9
- Value must be in hex
- Top line must be included exactly as is
- HKEY_CURRENT_USER cannot be abbreviated
- dword cannot be omitted
Command Prompt:
REG ADD HKCU\Console\%SystemRoot^%_system32_cmd.exe /v CodePage /t REG_DWORD /d 65001
- Value can be in dec or hex
- %SystemRoot% must be escaped
- REG_DWORD cannot be omitted
PowerShell:
New-Item -ErrorAction Ignore HKCU:\Console\%SystemRoot%_system32_cmd.exe
Set-ItemProperty HKCU:\Console\%SystemRoot%_system32_cmd.exe CodePage 65001
- Value can be in dec or hex
-Type DWord
is assumed with PowerShell 3+- Can use
ni -> New-Item
- Can use
sp -> Set-ItemProperty
- Can use
-ea 0 -> -ErrorAction Ignore
Cygwin:
regtool add '\HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe'
regtool set '\HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe\CodePage' 65001
- Value can be in dec or hex
- Can use
/ -> \
- Can use
HKCU -> HKEY_CURRENT_USER
- Can use
user -> HKEY_CURRENT_USER