Solution to Chinese garbled characters in centos

Source: Internet
Author: User
Tags i18n

When you use centos, you may encounter centos in English. In this case, centos is installed by default (in English ). After installation, various Chinese characters are garbled. So, how can we solve this problem.

1. The centos system accesses g.cn and finds Chinese garbled characters.

Therefore, the previous formula: Yum-y install fonts-Chinese
After the centos system is installed, the Chinese font still cannot be displayed. I used gedit to edit the source code, and its Chinese comments were garbled.

Later, we finally found the following solution and needed two packages supported by Chinese characters:
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 a Chinese font and the other is a font display package.

After the download, install it on the command line:
# Rpm-IVH xxxx (XXXX indicates the full names of the above two packages. I don't know how to use rpm ?)
After the centos system is installed, restart it.

2. garbled display on terminals and gedit

# Vi/etc/sysconfig/i18n
Set lang = "en_US.UTF-8"
Sysfont = "latarcyrheb-sun16"
Modify the original content
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
System-> logout
When you log on to the centos system again, you will find that all interfaces have changed from English to Chinese. Enter the date command on the terminal to test
# Date
Monday, November 24, 2009 12:07:00 CST

Iii. Solutions to garbled Chinese characters on the Telnet terminal over SSH (centos 5.3)

# Vi/etc/sysconfig/i18n
Set the original content lang = "en_US.UTF-8"
Sysfont = "latarcyrheb-sun16"
Modify
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 on the terminal to test
# Date
Monday, November 24, 2009 12:09:00 CST

4. Use Chinese Input Methods in centos 5.3

My previous method was to install the Penguin edition. See the next page. Here, there is also a simpler one, as long as you 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 ).

Now, you can enter Chinese characters. The problem of Chinese garbled characters in the centos system is solved in this way.

Linux: centos 5.3

The newly installed centos 5.3 cannot contain Chinese input methods, or even Chinese fonts cannot be displayed in the browser. Of course, English is certainly displayed.

At first, it was still a problem to display Chinese fonts in the browser. How can this problem be solved? I thought it was very complicated. You can do it with a command:

Yum install fonts-Chinese

Then reboot.

The following describes how to install the Chinese input method so that you can use it in the same way as in windows.

We chose to install the Input Method software: Penguin input method. Version: fcitx-3.6.0-rc.tar.bz2

Installation Method: source code installation, and all use the command line method.

I. Solve the dependency problem of fcitx in advance

Fcitx depends on: gettext, gettext-devel, libxft, libxft-devel, libxpm, and libxpm-devel. You can use the yum install software package name to install them separately in advance to solve the dependency problem.

Note: For Ubuntu, you only need to change Yum to Apt-Get.

Ii. Compilation and Installation

1. download the latest fcitx source code package: wget http://fcitx.googlecode.com/files/fcitx-3.6.0-rc.tar.bz2

2. Decompress to "/usr/src": tar-jxvf fcitx-3.6.0-rc.tar.bz2-C/usr/src

3. Go to the directory: CD/usr/src/fcitx-3.6.0

4. Generate the ". Configure" file:./autogen. Sh (Note: If you have installed GCC)

5. Start Compilation:./configure

Note: There will be a warning during the compilation process in centos 5, so ignore it. It's okay. There is no warning in RHEL.

6. Official installation: Make & make install

7. test whether the installation is successful: Enter fcitx-H. If the installation is successful, you should be able to get the help file, as shown below:

Usage: fcitx [Option]

-D run as daemon (default)

-D Don't run as Daemon

-N [im name] Run as specified name

-V display the version information and exit

-H display this help and exit

3. Configure fcitx as the default input method

Create a configuration file: Vim/etc/X11/xinit/xinput. d/fcitx. The content is as follows:

Xim = fcitx

Xim_program = fcitx

Gtk_im_moudle = fcitx

Qt_im_moudle = fcitx

Save reboot. After the device is started, enter fcitx in the terminal.

The following prompt appears:

Please set xmodifiers

Enter fcitx-Nb in the terminal.

The error message is:

Start fcitx error. Another xim daemon named fcitx is running?

Cannot be used normally! CTRL + space does not respond.

The solution is as follows:

1. Create a configuration file: Vim/etc/X11/xinit/xinput. d/zh_cn. The content is as follows:

Xim = fcitx

Xim_program = fcitx

Gtk_im_module = fcitx

Xmodifiers = "@ im = fcitx"

Gnome-im-settings-daemon>/dev/null

2. Modify/etc/sysconfig/i18n (this file controls the session interface language and other information)

Lang = "en_US.UTF-8" changed

Lang = "zh_CN.UTF-8"

3. Modify the hidden file. bashrc in your user subdirectory in/home.

Add two lines:

Export lc_ctype = "zh_cn"

Export xmodifiers = "@ im = fcitx"

Add another row:

Export lang = "zh_CN.UTF-8"

After all the changes are completed, reboot

Run fcitx on the terminal after startup

If not, the terminal will execute the following two sentences:

Export xmodifiers = "@ im = fcitx"

Ln-S/etc/X11/xinit/xinput. d/fcitx/$ home/. xinputrc

Reboot again. Run fcitx on the terminal after startup

Everything is OK! ~

You can use Ctrl + space to switch between Chinese and English.

For Linux systems, the installation of Chinese input methods is far more complex than that in windows. However, once these problems are solved. You will find that you do not feel comfortable working in Linux or windows.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.