Current location - Plastic Surgery and Aesthetics Network - Wedding planning company - When Android uses Log to print logs, Chinese characters are garbled. How to solve it?
When Android uses Log to print logs, Chinese characters are garbled. How to solve it?
It is because the code displayed in the DOS window is different from that displayed in the logcat log that the code is garbled. The default encoding of DOS window is GBK, while LogCat prints UTF-8 encoding, so you need to set DOS character encoding:

1, enter chcp 6500 1 at the current command line, and then press Enter. At this point, the current code page uses UTF-8 encoding.

2. Modify the window properties and change the font. Right-click the title bar of the command line and select Properties->; Font, change the font to the True Type font "Lucida Console", and then click OK to apply the properties to the current window.

3, and then print the log with logcat, and the Chinese characters can be displayed normally.

4. Supplementary codes corresponding to some character codes:

6500 1——UTF-8

936- Simplified Chinese

950- Traditional Chinese

437- American/Canadian English

932- Japanese

949- Korean

866- Russian