Home  >  Article  >  Operation and Maintenance  >  Chinese characters display garbled characters after installing centos7

Chinese characters display garbled characters after installing centos7

王林
王林Original
2020-04-03 10:35:302478browse

Chinese characters display garbled characters after installing centos7

Cause analysis:

It may be that the Chinese package is not installed.

Solution:

1. Check whether the Chinese package is installed.

locale -a |grep "zh_CN"

Chinese characters display garbled characters after installing centos7

No output, indicating that it is not installed. Enter the following command Installation:

yum groupinstall "fonts" -y

The installation is complete, check which Chinese language packages are installed

[root@iz2ze6adlpez0gy7j13vrmz /]# locale -a | grep "zh_CN"
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8

It means that the Chinese language package has been installed on the system and there is no need to install it again.

2. Modify the configuration file

Before modifying the configuration 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 language of the machine The environment is not Chinese, and the locale.conf configuration file needs to be modified.

Chinese characters display garbled characters after installing centos7

Enter the editing page, enter i to start editing, enter esc to enter the bottom line mode after editing, then enter: wq, save and exit.

Chinese characters display garbled characters after installing centos7

Check the current system language environment again

# 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=

Recommended related tutorials: centos tutorial

The above is the detailed content of Chinese characters display garbled characters after installing centos7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn