Home  >  Article  >  php教程  >  Four steps to solve the problem of Chinese garbled characters in Linux system

Four steps to solve the problem of Chinese garbled characters in Linux system

高洛峰
高洛峰Original
2016-12-15 16:24:321398browse

When using the CentOS system, you may encounter the English CentOS system during installation. In this case, the CentOS system is installed by default (i.e. English). After the installation is completed, various Chinese garbled characters appear. So, how do we solve this problem.

1. When accessing g.cn on CentOS system, Chinese garbled characters were found.

So I used the previous method: yum -y install fonts-chinese
After installing the CentOS system, Chinese fonts still cannot be displayed. I use gedit to edit the source code, and the Chinese comments are also garbled.

Later, I finally found the following method to solve the problem, which requires two Chinese support packages:
fonts-chinese-3.02-12.el5.noarch.rpm
ftp://ftp.muug.mb.ca/mirror/centos/ 5.4/os/x86_64/CentOS/fonts-chinese-3.02-12.el5.noarch.rpm


fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm
ftp://ftp.muug.mb. ca/mirror/centos/5.4/os/x86_64/CentOS/fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm
One is Chinese fonts and the other is font display package.

After downloading, install on the command line:
#rpm -ivh XXXX (XXXX represents the full name of the two packages above, don’t you know how to use rpm?)
After the CentOS system is installed, just restart.

2. Terminal and gedit display garbled characters

#vi /etc/sysconfig/i18n
Change LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
Modify the original content to
LANG="zh_CN.GB18030 "
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en"
SYSFONT="lat0-sun16"

Use yum install Chinese fonts
#yum install fonts-chinese.noarch
system -> logout log out
and log in again to the CentOS system, you will find that all interfaces have been changed from English to Chinese. Enter the date command in the terminal to test
#date

3. Solution to garbled Chinese display in ssh and telnet terminals (CentOS 5.3)

#vi /etc/sysconfig/i18n
Change the original content LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
Modified to
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh:en_US.UTF -8:en_US:en"
SYSFONT="lat0-sun16"

Use yum to install Chinese fonts
#yum install fonts-chinese.noarch
Disconnect ssh and reconnect
Enter the date command in the terminal to test
#date

4. Using the Chinese input method in CentOS system 5.3

My previous method was to install the Penguin version, see the next page. Here, there is an easier one, just use yum to install SCIM.
Command line input:
#yum install scim
#yum install scim-pinyin
Restart X (press Ctrl+Alt+Backpace) or log out (logout).

Okay, you can enter Chinese. The problem of Chinese garbled characters in CentOS system is solved in this way.

For more four-step solutions to the problem of Chinese garbled characters in Linux systems, please pay attention to 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