Closed abdusco closed 4 years ago
@c-rilaun I know that already. I've found this setting from the link you posted. The reason I've created this issue is to see if it can be automated using a script.
@abdusco If you know that already, you have your answer. There is all you need to know for this settings :
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
Changing HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP value to 65001 appear to make the system unable to boot in my case.
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
Quick edit : Some settings are uncommon, like this one and the edit of Windows value by regedit could be dangerous (especially for this one). So i don't think if a dangerous feature, uncommon, will be added to the script. But you can fork the git repo and make your custom tool. (Don't hesitate to correct my poor english)
This would probably cause more problems than it would solve. Even if the tweak would exist,there is no clear way how to revert it as the original values depend on the default locale/language of the OS. I.e. de_DE or ru_RE have different values than en_US. Moreover, it also affects old GUI (non-unicode) applications, which may lead to unexpected behavior even though the apps will appear to run and display normally. (I've had some fun with this on one ancient central european accounting system.)
So if you need it really just for console apps, then the solutions found by @c-rilaun seem the best. Either chcp 65001
for particular script/session or the Command Processor\Autorun
key for all cmd sessions.
If you'd really want to achieve the same as the checkbox does, you can create a custom tweak with following
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Nls\CodePage" -Name "ACP" -Type String -Value 65001
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Nls\CodePage" -Name "OEMCP" -Type String -Value 65001
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Nls\CodePage" -Name "MACCP" -Type String -Value 65001
Notice that the values are strings and not dwords as one might expect. The person asking the question on SuperUser claims they've had problems with boot on Windows 7 after setting the OEMCP
value, which may have been caused by using the wrong type. I have tested it just now on Win10 with the PS commands above and it booted normally.
The person asking the question on SuperUser claims they've had problems with boot on Windows 7 after setting the
OEMCP
value, which may have been caused by using the wrong type. I have tested it just now on Win10 with the PS commands above and it booted normally.
I do not know whether anyone will read this, but I just wanted to say that setting OEMCP
to 65001
does break Windows 7, so something must have changed in the code in the meantime between 7 and 10.
Windows by default doesn't support printing utf-8 characters in console applications. One way to solve this is to change ansi code page, but a better way is to enable it from settings, which solves the problem altogether:![image](https://user-images.githubusercontent.com/3243482/60512395-1f661500-9cdd-11e9-8079-e234915e9cfe.png)
I'm not sure how enabling this changes registry, but is it possible to add support for this setting?