When you first start using the Linux system, everyone will encounter a problem, that is, when the terminal input command is echoed, the Chinese characters are displayed as garbled characters. Why does such a problem occur? When such a problem occurs, how should we solve it? What's the solution? Today, the editor will tell you about the solution to Chinese garbled characters in Linux.
The steps are as follows:
1. How to view and set the system language package in Linux
1. View the current system language
After logging in to the Linux system and opening the operating terminal, enter echo $LANG to view the currently used system language. Such as
2. Check the installed language pack
To see if there is a Chinese language pack, you can enter the locale command in the terminal. If there is zh cn, it means that the Chinese language has been installed
3. What if there is no Chinese language?
You can download and install the Chinese language package yum groupinstall chinese-support from the Internet (if you cannot connect to the Internet, download it from other computers, upload it)
2. How to modify the system language to Chinese
1. Temporarily change the language
If you only temporarily change the language environment of the Linux system, you can set LANG=language name by inputting it, such as Chinese is
Zn_CN.UTF-8 (note that this is originally Chinese, I temporarily set it to English
2, Modify the system default language
The above method is to set the system default language configuration by modifying it
For example, Vi /etc/sysconfig/i18n (note to restart the system after changing it)
3. Other precautions
If you follow If the above method settings and modifications to the Chinese language still don’t work, pay attention to the encoding selected by your link terminal. For example, xshell, select Chinese or UTF8 for the terminal encoding. 4. After setting it up, try again. Check the previous garbled files and you will see that they are displayed in Chinese
The above is the entire content of the editor’s introduction to the solution to Chinese garbled files in Linux. Such problems are usually caused by the Chinese language package not being installed, or. There is a problem with the default language setting. You can try the above method to solve it!
Please pay attention to the PHP Chinese website for more related articles on how to solve the Chinese garbled code in Linux!