Home > Article > Operation and Maintenance > How to solve the problem of garbled Chinese characters displayed under centos7
1. Check whether the Chinese package is installed
You can use the following naming to check whether the Chinese installation package is installed on the system.
locale -a |grep "zh_CN"
There is no output, indicating that it is not installed. Enter the following command to install:
yum groupinstall "fonts" -y
2. Modify the configuration file
After modifying the configuration Before file, let’s take a look at the current system language environment:
# echo $LANG en_US.UTF-8 # locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=
Although the Chinese language pack is installed, the locale of this machine is not Chinese. You need to modify the locale.conf configuration file
# vim /etc/locale.conf LANG="zh_CN" # source /etc/locale.conf
to enter On the editing page, enter i to start editing. After editing, enter esc to enter the bottom line mode, then enter: wq, save and exit.
Then check the current locale:
# echo $LANG zh_CN # locale LANG=zh_CN LC_CTYPE="zh_CN" LC_NUMERIC="zh_CN" LC_TIME="zh_CN" LC_COLLATE="zh_CN" LC_MONETARY="zh_CN" LC_MESSAGES="zh_CN" LC_PAPER="zh_CN" LC_NAME="zh_CN" LC_ADDRESS="zh_CN" LC_TELEPHONE="zh_CN" LC_MEASUREMENT="zh_CN" LC_IDENTIFICATION="zh_CN" LC_ALL=
3. Verification is successful
[root@node2 ~]# date 2017年 10月 16日 星期一 16:30:24 CST
Recommended related tutorials: centos tutorial
The above is the detailed content of How to solve the problem of garbled Chinese characters displayed under centos7. For more information, please follow other related articles on the PHP Chinese website!