Several methods to modify the computer console encoded

In the development of our program is a unified coding UTF-8, which is important, but the total will still encounter many problems garbled, garbled reasons are many, they will not summarize here too. Herein only use the console to perform some procedures have written in the window, or interactive programming will often encounter when garbage problem, because the default encoding Window cmd is GBK. UTF-8 is inconsistent with the procedures adopted by the Chinese cause and special characters garbled.

 

 

 

The first embodiment: the console display encoder temporary fixes

Use chcp command, for example chcp 65001, which goes back to the current code page utf-8 encoding, but this way will automatically expire after the close cmd.

 

Common coding and the corresponding code values ​​(decimal):

 

 

 

 

The second way: a permanent modification

Permanent modification is to modify the registry to achieve registration.

Open the registry Method: win + r -> regedit

Navigate to: HKEY_CURRENT_USER \ Console \% SystemRoot% _system32_cmd.exe

Note that the default is not the key value. Only the modified settings in the title bar of the right to appear. Delete this item, it will use the default settings of the console. If you want to modify, you can set cmd in the title bar of the right, just modify a property, then refresh the registry on it.

 

 

If not CodePage right, the right to create a new DWORD value directly can be modified to 65001 (decimal 65001) The same may be modified: the default encoding powershell. If the problem can not be modified because the permissions, you can select the right to the left of the red box, select the permissions, assign permissions themselves full control on it!

Dry notes more attention to micro-channel public number: the old nine school

Guess you like

Origin www.cnblogs.com/ljxt/p/11612840.html