131
80
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)
Note the purposed solution could break Windows' find.exe (which would cause problems with Android SDK build): http://superuser.com/questions/176737/why-find-exe-not-work-in-windows-7
– J Rao – 2015-01-18T05:24:55.103Hm, when I use chcp 65001 my console windows crash when I do dir, but it helps to simply start cmd.exe with the /u flag (nb: it does use unicode by it is not reflected in chcp.com output) – eckes – 2015-01-27T18:58:14.173
Using the UTF-8 code-page also breaks the
more
command (it gives the misleading error messageNot enough memory.
) Opening the command-prompt with the/U
switch does not help. – Synetech – 2016-03-07T22:00:26.51010The Windows console is riddled with bugs when the encoding is set to an unsupported multi-byte code page like 65001. Any software using the output counts of the Win32 WriteFile/ReadFile APIs will get the wrong results and consequently stuff build on that like the MSVCRT's implementation of the stdlib will produce mangled/repeated output and hang on input when confronted with non-ASCII. Until MS get around to fixing it — and it has been decades with no sign of that happening — globally changing console code page to 65001 is an extraordinarily bad idea. – bobince – 2016-10-14T08:51:51.240
2Any use of the
A
versions of Windows functions is broken. All code needs to be ported to use theW
versions. – Demi – 2017-04-07T14:42:44.2101
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP
is used as fallback for non-unicode (non-utf) environments, obviously you try to force it to a 'unicode', as you see it is controversal by definition. Windows hangs probably because some system stuff on boot depends on non-unicode charset to work. – venimus – 2017-08-23T15:00:24.830