The Linux character encoding defaults to UTF-8, which can be set to GBK if garbled

Source: Internet
Author: User
Tags i18n posix

The Linux character encoding defaults to UTF-8, which can be set to GBK if garbled
1. Manually change the profile command:

VI /etc/profile

You can also modify the/etc/sysconfig/i18n file, such as

lang="en_US. UTF-8"LANG="zh_cn.gb18030 "


There is another way cp/etc/sysconfig/i18n $HOME/.i18n

Modify the $HOME/.i18n file, as

lang="en_US. UTF-8"LANG="zh_cn.gb18030 "

This allows you to change your personal interface language without affecting other users.
The modified/etc/sysconfig/i18n file is:

lang="en_US. UTF-8"supported="zh_cn. GB18030:zh_CN:zh:en_US. Utf-8:en_us:en"sysfont="latarcyrheb-sun16"lc_all ="en_US." UTF-8"export Lc_all

2. Add the following two lines of command at the end of the file:

Export lc_all="zh_cn. GBK"export LANG="zh_cn.gbk "

The configuration that is required is mainly:
en_US. UTF-8 UTF-8
en_US iso-8859-1
ZH_CN GB2312
Zh_cn. GB18030 GB18030
Zh_cn. GBK GBK
Zh_cn. UTF-8 UTF-8
The default is en_US. UTF-8 UTF-8
3. You can also add the following two lines at the end of the/root/.bash_profile file:

Export lc_all="zh_cn. GBK"export LANG="zh_cn.gbk "

Restart the server for the changes to take effect.
4. After successful modification, use the locale command to view, the default setting before modification is:

# Localelang=en_us. utf-8lc_ctype="POSIX"lc_numeric="POSIX"Lc_time="POSIX"lc_collate="POSIX"lc_monetary="POSIX"lc_messages="POSIX"Lc_paper="POSIX"Lc_name="POSIX"lc_address="POSIX"Lc_telephone="POSIX"lc_measurement="POSIX"lc_identification="POSIX"

5. The configuration after successful modification is:

# Localelang=ZH_CN. Gbklc_ctype="ZH_CN.GBKLc_numeric="ZH_CN. GBK"Lc_time="ZH_CN. GBK"lc_collate="ZH_CN.GBKlc_monetary="ZH_CN. GBK"lc_messages="ZH_CN. GBK"Lc_paper="ZH_CN. GBK"Lc_name="ZH_CN. GBK"lc_address="ZH_CN. GBK"Lc_telephone="ZH_CN. GBK"lc_measurement="ZH_CN. GBK"lc_identification="ZH_CN. GBK"Lc_all=zh_cn. GBK

The Linux character encoding defaults to UTF-8, which can be set to GBK if garbled

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.