Fix Chinese Garbled Text in Ubuntu Terminal

The occurrence of garbled characters is usually caused by incorrect character encoding settings on the terminal. The solution is as follows:

  1. Check the character encoding settings of the terminal to see if they are correct. Execute the following command in the terminal to check the current character encoding settings.
  2. The local area
  3. Make sure that the value of the LC_ALL or LANG field in the output is the correct Chinese encoding, such as zh_CN.UTF-8 or zh_CN.UTF-8.
  4. You can fix the character encoding issue by modifying the environment variables. Execute the following command in the terminal:
  5. Set the language environment to Chinese (Simplified) with UTF-8 encoding.
  6. After making this adjustment, you should be able to display Chinese characters correctly by restarting the terminal or logging in again.
  7. If the above method still cannot solve the problem, try changing the font settings of the terminal. Open the terminal’s preferences or configuration interface, and select a font that supports Chinese display, such as WenQuanYi Micro Hei.
  8. If none of the above methods work, it could be an issue with the terminal itself. You can try using other terminal tools, such as xterm or konsole, to see if Chinese characters display correctly.

I hope the above methods can help you solve the problem of garbled Chinese characters on your terminal.

bannerAds