How to solve the problem of garbled Chinese characters displayed under centos7

王林
Release: 2020-04-02 10:24:48
Original
2542 people have browsed it

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"
Copy after login

How to solve the problem of garbled Chinese characters displayed under centos7

There is no output, indicating that it is not installed. Enter the following command to install:

yum groupinstall "fonts" -y
Copy after login

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=
Copy after login

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
Copy after login

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.

How to solve the problem of garbled Chinese characters displayed under centos7

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=
Copy after login

3. Verification is successful

[root@node2 ~]# date
2017年 10月 16日 星期一 16:30:24 CST
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!