How to solve the file output of the Android system in the CMD command line showing garbled characters in Chinese

1. Problem background


In the process of testing the Android system, Chinese characters appeared garbled when the file in the cat system was commanded through the shell. After searching the Internet, there was a solution. After finishing the system today, the symptoms of the problems I encountered are as follows:

2. Temporary solution


1. Open the command line window of CMD.exe
2. Change the code page through the chcp command, the code page of UTF-8 is 65001
chcp 65001 After
performing this operation, the code page is changed to UTF-8.

Note: The above method will only solve the problem in the current cmd window, but the reopened cmd window or power shell window still cannot display Chinese characters correctly.

Third, the ultimate solution (by modifying the registry)


1. Win+R enter regedit to enter the registry
2. Find HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe If there is already a CodePage item under this item, change the value to decimal "65001"; if it does not exist, under this item Create a new DWORD (32-bit value), name it "CodePage", and set the value to "65001"
3. Restart cmd to take effect
4. The same for Power shell modification, just modify
%SystemRoot%_system32_WindowsPowerShell_v1.0_powershell.exe in step 2 Item under.

The schematic diagram is as follows:

 

Guess you like

Origin blog.csdn.net/jinhoward/article/details/108286102
Recommended