A really effective way to solve the problem of CentOS Chinese garbled

Source: Internet
Author: User
Tags i18n

First, Chinese support
Install the Chinese Language pack:

The code is as follows:
Yum Groupinstall Chinese-support
Modify the character encoding configuration and create it without this file:

The code is as follows:
vim/etc/sysconfig/i18n
The following changes are included:

The code is as follows:
Lang= "ZH_CN. Gb18030″
Supported= "ZH_CN. Utf-8:zh_cn:zh:en_us. Utf-8:en_us:en "
Sysfont= "Latarcyrheb-sun16″
The i18n file is used to set the system language, such as: ZH_CN. UTF-8, ZH_CN. GB18030, ZH_TW. Big5, en_US. UTF-8 and so on.
Three environment variables in i18n:
Lang variable, set the system language.
The supported variable determines the language that the system supports, i.e. the language that the system can display.
The Sysfont variable represents the system font.
Finally, restart the server:

The code is as follows:
Reboot
This will appear in the character interface command interaction in Chinese, but some of the translation is not complete.
Use the locale command to view the system language settings:

The code is as follows:
Locale</p> <P>LANG=ZH_CN. GB18030
Lc_ctype= "ZH_CN. Gb18030″
Lc_numeric= "ZH_CN. Gb18030″
Lc_time= "ZH_CN. Gb18030″
Lc_collate= "ZH_CN. Gb18030″
Lc_monetary= "ZH_CN. Gb18030″
Lc_messages= "ZH_CN. Gb18030″
Lc_paper= "ZH_CN. Gb18030″
Lc_name= "ZH_CN. Gb18030″
Lc_address= "ZH_CN. Gb18030″
Lc_telephone= "ZH_CN. Gb18030″
Lc_measurement= "ZH_CN. Gb18030″
Lc_identification= "ZH_CN. Gb18030″
Lc_all=
The default language is en_US. UTF-8 or POSIX, set to ZH_CN. GB18030.

Second, vim display Chinese
After installing the Chinese package, you also need to edit the VIM profile VIMRC:
Vim/etc/vimrc
At the end, add the following:

The code is as follows:
Set Fileencoding=utf-8
Set Fileencodings=utf-8,gb18030,gbk,big5


PS: Let Linux VPS support Chinese mainly for the convenience of viewing such as WordPress, discuz Program notes and comments, are Chinese version of it.


PS2: This set after the system and vim can display Simplified Chinese, but traditional Chinese still can't display, do not know where to set the wrong ah? My understanding is that the system language has Chinese, vim is a text editor, set to UTF-8 encoding format, all UTF-8 encoded text can be displayed? Or there is no corresponding font so it shows garbled, then installed in the Chinese language pack has no traditional Chinese font?


PS3: Tried several times found in i18n file lang set to zh_cn.gb18030, ZH_CN.GBK, zh_cn.gb2312 can display the Simplified Chinese normally, but set to Zh_cn.utf-8, will be garbled.

A really effective way to solve the problem of CentOS Chinese garbled

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.