garbled characters appear in Linux
How to set the Chinese language of the Linux system, this is what many friends ask when they start using Linux Sometimes, we will encounter a problem, that is, when the terminal input command is echoed, the Chinese characters are displayed as garbled characters. This situation usually occurs because the Chinese language pack is not installed, or there is a problem with the default language set. Taking centos as an example, how to check the language and set and modify the language when operating Linux
1. Check the current system language
Log in to the linux system After opening the operation terminal, enter echo $LANG to view the currently used system language. Such as
2. Check the installed language pack
Check whether 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. If there is no Chinese language,
can download and install the Chinese language package from the Internet. yum groupinstall chinese-support
After installation
enter the localecommand
4. 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, for example, Chinese is LANG=zh_CN.UTF-8
2. Modify the system default language
The above method is to set the system default by modifying Language configuration
such as vi /etc/sysconfig/i18n (note to restart the system after making changes)
##5. Other notes
If setting and modifying the Chinese language according to the above method still does not work, pay attention to the encoding selected by your link terminal. Take xshell as an example, select Chinese or UTF8 for the terminal encoding##cmd input chcp 65001 to switch to utf-8 encoding
Centos6 solution:
yum install fontconfig-devel yum groupinstall chinese-support
centos7 system:
yum install fontconfig-devel yum groupinstall fonts
Recommended:
linux server tutorialThe above is the detailed content of How to solve garbled characters in Linux. For more information, please follow other related articles on the PHP Chinese website!