windows 7 - Cannot type non-ASCII character in console using UTF-8 (65001) codepage?
2014-07
First, I type
> chcp 950
to change console codepage 437 into codepage 950
I can type both non-ASCII character (TradChinese character) and ASCII.
But, if I type
> chcp 65001
I can only type ASCII character, but cannot type any non-ASCII character.
How to type non-ASCII character in console using UTF-8 (65001) codepage?
PS.
codepage 437: OEM-United States
codepage 950: ANSI/OEM-Traditional Chinese Big5
codepage 65001: UTF-8
Currently I'm running Windows 7 x64 and usually I want all console tools to work with UTF-8 rather than with default code page 850.
Running 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?
Update:
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
served just well for my purpose. (thanks to Ole_Brun)
To change the codepage for the console only, do the following:
- Start->Run->regedit
- Go to [HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Autorun]
- Change the value to chcp 65001
I don't like change the system. This creates a lot of problems for me. 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 cmd, changed the destination to: C:\Windows\System32\cmd.exe /k switch
Voilá, when I need to type in UTF-8, I use this link.