Home  >  Article  >  Operation and Maintenance  >  How to solve the problem of Chinese garbled characters in centos5.5

How to solve the problem of Chinese garbled characters in centos5.5

藏色散人
藏色散人Original
2022-01-11 14:44:081928browse

Solution to Chinese garbled characters in centos5.5: 1. Modify the "/etc/sysconfig/i18n" file; 2. Add "export LC_ALL="zh_CN.GB18030"" to the "/etc/profile" file ;3. Install font files.

How to solve the problem of Chinese garbled characters in centos5.5

The operating environment of this article: centos5.5 system, Dell G3 computer.

How to solve the problem of Chinese garbled characters in centos5.5?

CentOS 5.5 Chinese garbled problem solution

When you create a new CentOS host in VMware7.1, add CentOS 5.5 bin-DVD disc installation directly and you will be prompted to enter the user Password information, if installed in this way, CentoOS system configuration will be skipped directly. This may be an integrated function of the new version of VMware, but once skipped, there is no configuration to support the Chinese language. It will bring trouble to the subsequent Chinese translation work. But there is still a solution, as follows:

After installation. Full English interface, the only online search solution is:

Modify /etc/sysconfig/i18n file

 #LANG="en_US.UTF-8"
 
 #SUPPORTED="en_US.UTF-8:en_US:en"
 
 #SYSFONT="latarcyrheb-sun16"

is changed to

1 LANG="zh_CN.GB18030"
 
2 LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
 
3 SUPPORTED="zh_CN.GB18030:zh_CN:zh"
 
4 SYSFONT="lat0-sun16" SYSFONTACM="8859-15"

In this way, Chinese can generally work normally in SSH and telnet terminals shown.

If it still doesn’t work, you can do this:

1. Console terminal garbled code

Add the following content to the last line of the /etc/profile file:

export LC_ALL="zh_CN.GB18030"

2. xwindow terminal garbled code

Add the following content to the last line of the /etc/sysconfig/i18n file :

export LC_ALL="zh_CN.GB18030"

First of all, modify it. They are all garbled codes in square boxes, and the Chinese version cannot be used. It doesn't work after reboot either. Although most people say that it takes effect immediately without restarting.

Then I think it may be because there is no font,

 yum install fonts-chinese.noarch
 
 yum install fonts-ISO8859-2.noarch

How can I still display the method? Frame Chinese characters. Next I want to start by modifying the font.

Download Wenquanyi’s Zhenghei font installation,

1. Unzip the compressed package of the font file:

su -
tar zxvf wqy-zenhei*.tar.gz

2. Place the unzipped folder “wqy-zenhei” Move to the /usr/share/fonts/wenquanyi/ directory:

mv wqy-zenhei /usr/share/fonts/wenquanyi/
*如果/usr/share/fonts/wenquanyi/不存在,请先建立:
mkdir -p /usr/share/fonts/wenquanyi/

3. Edit the /etc/X11/xorg.conf file:

cp /etc/X11/xorg.conf /etc/X11/xorg.conf.back
vim /etc/X11/xorg.conf

4. Find the FontPath section and add:

FontPath “/usr/share/fonts/wenquanyi/wqy-zenhei”

Save the file.

5. If your system has the /etc/fonts/fonts.conf file, please edit it:

cp  /etc/fonts/fonts.conf /etc/fonts/fonts.conf.back
vim /etc/fonts/fonts.conf

6. Add before 9db236e7e3a8be9de3bbb11e39ce13bd:

<dir>/usr/share/fonts/wenquanyi/wqy-zenhei/</dir>

save document.

7. If your system uses fontconfig 2.4.x, move the 44-wqy-zenhei.conf file under /usr/share/fonts/wenquanyi/wqy-zenhei/ to ~/.font. conf

Restart the X server and select the Chinese font. Chinese is finally displayed, but it is a bit ugly. It would be good to modify the theme and make some fine adjustments.

Next, install the zend server ce for linux version. Because I have modified the domestic source, installation with a script may be very slow. Directly download the installation package, decompress it and install successfully. After restarting, an error message appears: cannot restore segment prot after reloc:permission denied.

1How to turn off SELINUX:

vi /etc/selinux/config Change SELINUX=enforcing to SELINUX=disabled. Restart is required

This method may bring risks to the server.

2 Method of not closing SELINUX:

# setenforce 0
# chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/local/apache/modules/libPHP5.so
# service httpd restart
# setenforce 1

Finally solved, but without Wubi, isn’t this fatal? To solve this problem, install fcitx through comprehensive comparison:

Under CentOS 5.5, use the source code package to install Fcitx. The latest version of Little Penguin Input Method: fcitx-3.6.3-rc.tar.bz2

First of all, declare 2 points:

1. All operations in this article are performed under the terminal. Unless otherwise stated, the commands in this article are all entered under the "Terminal".

2. Because CentOS is completely based on Redhat enterprise linux (RHEL), the method of installing Fcitx in this article is completely 100% applicable to RHEL.

1. Solve the dependency problem of Fcitx in advance

Fcitx depends on: gettext, gettext-devel, libXft, libXft-devel, libXpm and libXpm-devel, this Six software packages.

You can use yum install package name to install them separately in advance to solve dependency problems.

yum install gettext gettext-devel libXft libXft-devel libXpm libXpm-devel automake autoconf libXtst-devel 
gtk+-devel gcc zlib-devel libpng-devel gtk2-devel glib-devel
yum install gettext-devel
yum install libXft-devel
yum install libXpm-devel
yum install automake
 
yum install libXtst-devel

2. Compile and install

1. Download the source code package of the latest version of Fcitx: wget http://fcitx.googlecode.com/files/fcitx-3.6 .3.tar.bz2

2. Unzip to "/usr/src": tar -jxvf fcitx-3.6.3.tar.bz2 -C /usr/src

3 . Enter the directory: cd /usr/src/fcitx-3.6.3

4. Generate the ".configure" file: ./autogen.sh

5. Start compiling: ./configure

Note: There will be warning prompts during the compilation process under Centos 5, please ignore it, it will be fine. There will be no warning under RHEL.

6. Formal 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 follows:

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

Installation method one:

1. Create a new configuration file: vim /etc/X11/xinit/xinput.d/fcitx, the content is :

XIM=fcitx
XIM_PROGRAM=fcitx
GTK_IM_MOUDLE=fcitx
QT_IM_MOUDLE=fcitx

Save and exit, restart the computer

2. 查询Fcitx是否开机运行。终端下输入:fcitx,应该是提示:Start FCITX error. Another XIM daemon named SCIM is running?这样就对了,直接到”4“

3. 如果没任何提示,则:ln -s /etc/X11/xinit/Xinput.d/fcitx /$HOME/.xinputrc

4. 输入: fcitx -nb ,即可看到输入框

默认fcitx启动后,是在后台运行的,因此看不到输入框,用上面的命令就可以调出来了。

ctrl+空格 切换输入法。

安装方法二:

首先在/etc/X11/xinit/xinput.d/目录下建立一个新文件(fcitx.conf):

XIM=fcitx
XIM_PROGRAM=/usr/local/bin/fcitx
XIM_ARGS=”-d”
GTK_IM_MODULE=fcitx
QT_IM_MODULE =fcitx

然后在/etc/alternatives/目录下,将符号链接xinputrc删除,重新建一个:

mv /etc/alternatives/xinputrc /etc/alternatives/xinputrc.save
rm –rf /etc/alternatives/xinputrc
ln -s /etc/X11/xinit/xinput.d/fcitx.conf /etc/alternatives/xinputrc

最后,在开始菜单> 系统> 首选项preferences > 更多首选项more preferences >输入法input method,在里面选择“使用系统范围内的配置[fcitx]”,然后“注销”,登录后按“ctrl+空格”就可激活fcitx输入法。

配置fcitx输入法修改~/.fcitx/config文件中的相应偏好设置。

三、卸载方法

进入目录:cd /usr/src/fcitx-3.6.3
make uninstall

 

功能介绍

1、常用热键

* 打开/关闭输入法:左ctrl+空格/左ctrl+左shift

* 快速中英文切换:左ctrl

* 切换输入法:alt+1–>五笔 alt+2–>拼音 alt+3–>区位,或用左ctrl+左shift进行循环切换

* 切换全/半角:左shift+空格

* 候选字/词翻页:,./-=

* 重新读入设置:左ctrl+5

还可以安装拼音输入法、在CentOS系统 5.3 中使用中文输入法

命令行输入:

#yum install scim
#yum install scim-pinyin

重启动X(按Ctrl+Alt+Backpace)或注销(logout)。

推荐教程:《centos教程

The above is the detailed content of How to solve the problem of Chinese garbled characters in centos5.5. 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
Previous article:Where is centos vimrcNext article:Where is centos vimrc