Change default code page of Windows console to UTF-8

To change the codepage for the console only, do the following:

  1. Start -> Run -> regedit
  2. Go to [HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Autorun]
  3. Change the value to @chcp 65001>nul

If Autorun is not present, you can add a New String


Personally, I don't like changing the registry. This can cause a lot of problems. I created a batch file:

@ECHO OFF
REM change CHCP to UTF-8
CHCP 65001
CLS

I saved at C:\Windows\System32 as switch.bat.

I created a link for cmd.exe on the Desktop.

In the properties of the cmd shortcut, changed the destination to: C:\Windows\System32\cmd.exe /k switch

Voilá, when I need to type in UTF-8, I use this link.


Edit the Registry:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]
"OEMCP"="65001"

Then restart. With this fix, if you are using Consolas font, it seems to lock PowerShell into a small font size. cmd.exe still works fine. As a workaround, you can use Lucida Console, or I switched to Cascadia Mono:

https://github.com/microsoft/cascadia-code