Log Chinese garbled problem when using adb logcat on Android, just use chcp 65001 to set the encoding

adb logcat log garbled problem

When using adb to debug Andoid's viewing log, I found that the Chinese log is garbled, as follows
Insert picture description here

For the method of adb debugging Android view log, please refer to my article: https://blog.csdn.net/linxinfa/article/details/104578095

Garbled reason

This is because the CMD default character set is ANSI, in the Chinese environment it is GBK, and the code page is 936. In Android, UTF-8 characters are used.
The method to query the current code page is to directly enter the chcpcommand under CMD
Insert picture description here

Solution

As long as the code page 65001 in UTF-8 format is used, the command is as follows: chcp 65001
Insert picture description here
Then re-use the logcat command to view the log to display the Chinese log normally
Insert picture description here

Guess you like

Origin blog.csdn.net/linxinfa/article/details/107615243