Modify the character encoding with garbled characters in centos. use centos to support Chinese characters.

Source: Internet
Author: User
Tags i18n
How to display Chinese garbled characters in your centos, as long as you modify the character encoding so that centos supports Chinese, you can create it without this file, the following is the modification steps CentOS

I. Chinese support

Install the Chinese language pack:

Copy codeThe code is as follows:
Yum groupinstall chinese-support

Modify the character encoding configuration and create it without this file:

Copy codeThe code is as follows:
Vim/etc/sysconfig/i18n

The modified content is as follows:

Copy codeThe 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 ″

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 SUPPORTED by the system, that is, the language that the system can display.
The SYSFONT variable indicates the system font.

Restart the server:

Copy codeThe code is as follows:
Reboot

In this way, Chinese characters will appear in the command interaction on the character interface, but some translations are incomplete.

Run the locale command to view the system language settings:

Copy codeThe code is as follows:
Locale

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, followed by zh_CN.GB18030.

II. display Chinese characters in vim

After installing the Chinese package, edit the vim configuration file vimrc:

Vim/etc/vimrc

Add the following content at the end:

Copy codeThe code is as follows:
Set fileencoding = UTF-8
Set fileencodings = UTF-8, gb18030, gbk, big5

PS: To enable Linux VPS to support Chinese characters, it is mainly used to facilitate viewing of comments and comments of wordpress and discuz programs.

PS2: After this setting, the system and vim can display simplified Chinese, but traditional Chinese still cannot be displayed. I don't know where I set the error ?? In my understanding, the system language is Chinese and vim is a text editor. it is set to the UTF-8 encoding format. can all UTF-8 encoded texts be displayed? There is still no corresponding font, so garbled characters are displayed, so there is no traditional Chinese font in the installed Chinese bag?

PS3: tried multiple times found in the i18n file LANG set to zh_CN.gb18030, zh_CN.gbk, zh_CN.gb2312 can be normal display of simplified Chinese, but set to zh_CN.utf-8, it will be 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.