Get the App
SLTechnology News&Howtos  ›  Servers  › 

Centos modifies character encoding to make centos support Chinese

Shulou Source: shulou.com Published: 2022-06-01 10:23:47 10月01日 Update

This article mainly explains "centos modifies character coding to make centos support Chinese". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "centos modifies character coding to make centos support Chinese".

1. 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 modified content is as follows:

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"

I18n files are used to set system languages, such as zh_CN.UTF-8, zh_CN.GB18030, zh_TW.Big5, en_US.UTF-8, etc.

Three environment variables in i18n:

LANG variable to set the system language.

The SUPPORTED variable determines the language that the system supports, that is, the language that the system can display.

The SYSFONT variable represents the system font.

Finally, restart the server:

The code is as follows:

Reboot

In this way, Chinese will appear in the command interaction of the character interface, but some of the translation is incomplete.

Use the locale command to view the system language settings:

The 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, and when set to zh_CN.GB18030.

2. Vim displays Chinese

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

Vim / etc/vimrc

Add the following at the end:

The code is as follows:

Set fileencoding=utf-8

Set fileencodings=utf-8,gb18030,gbk,big5

At this point, I believe you have a deeper understanding of "centos modifies character coding to make centos support Chinese". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Chinese language code system characters support coding content variables files commands learning configuration practical deeper three interests fonts practicality practical Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Redmi MySQL Shulou Information macOS