Linux garbled problem and its solving method

Source: Internet
Author: User
Tags i18n locale


The default encoding for Windows Gbk,linux is UTF-8. The Chinese, which is edited under Windows, is garbled under Linux. To resolve this issue, modify the default encoding for Linux to GBK.


1 Viewing the supported character sets

# locale-a


2 Installation The English version of the default character set is configured to

# cat/etc/sysconfig/i18n
Lang= "en_US. UTF-8 "
Sysfont= "Latarcyrheb-sun16"


3 Modify to Chinese character set

# vi/etc/sysconfig/i18n
Lang= "ZH_CN. GBK "
Supported= "ZH_CN. Utf-8:zh_cn:zh "
Sysfont= "Latarcyrheb-sun16"


4 The following command or reboot will take effect

# source/etc/sysconfig/i18n


  1. 1

    View current system language

    After logging on to the Linux system, enter the echo $LANG to view the system language currently in use. Such as

    650) this.width=650; "Src=" http://h.hiphotos.baidu.com/exp/w=500/sign=e63385515bee3d6d22c687cb73176d41/ 37d3d539b6003af38d894a96372ac65c1038b611.jpg "class=" Exp-image-default "alt=" Linux Chinese display garbled? How to set up CentOS display Chinese "/>

  2. 2

    To view installed language packs

    See if there is a Chinese language pack to enter locale commands at the terminal, if En cn indicates that the Chinese language is already installed

    650) this.width=650; "Src=" http://f.hiphotos.baidu.com/exp/w=500/sign=dfd58db589d4b31cf03c94bbb7d7276f/ 42166d224f4a20a4d31baa3192529822720ed03b.jpg "class=" Exp-image-default "alt=" Linux Chinese display garbled? How to set up CentOS display Chinese "/>

  3. 3

    What if there is no Chinese language?

    You can download and install the Chinese Language pack Yum groupinstall chinese-support(not networked through other computers to download, upload it)

    650) this.width=650; "Src=" http://d.hiphotos.baidu.com/exp/w=500/sign=0a39efce6c061d957d4637384bf50a5d/ Bf096b63f6246b60af0b2482e9f81a4c510fa23b.jpg "class=" Exp-image-default "alt=" Linux Chinese display garbled? How to set up CentOS display Chinese "/>

  4. 4

    How to modify the system language to Chinese


    1 Temporary language change

    If you are only temporarily changing the language environment of the Linux system, you can set the lang= language name by typing, such as Chinese

    Zn_cn. UTF-8 (Note that I am here originally in Chinese, I temporarily set to English

    650) this.width=650; "Src=" http://d.hiphotos.baidu.com/exp/w=500/sign=443b3249a2ec08fa260013a769ef3d4d/ 023b5bb5c9ea15ce85eb76ffb4003af33a87b23b.jpg "class=" Exp-image-default "alt=" Linux Chinese display garbled? How to set up CentOS display Chinese "/>

  5. 5

    Modifying the system default language

    The above method is to set the system default language configuration by modifying the

    such as vi/etc/sysconfig/i18n (pay attention to change the system after the restart )

    650) this.width=650; "Src=" http://d.hiphotos.baidu.com/exp/w=500/sign=781d13b8c88065387beaa413a7dca115/ Cf1b9d16fdfaaf5118d017498e5494eef01f7a11.jpg "class=" Exp-image-default "alt=" Linux Chinese display garbled? How to set up CentOS display Chinese "/>

  6. 6

    Other precautions

    If you follow the above methods to set the Chinese language or not, pay attention to the encoding of your link terminal selection.

    As an example of Xshell, the encoding of the terminal is selected in Chinese, or UTF8 can be

    650) this.width=650; "Src=" http://d.hiphotos.baidu.com/exp/w=500/sign=d803f873cbea15ce41eee00986013a25/ 203fb80e7bec54e7ede98ce8bb389b504fc26a3b.jpg "class=" Exp-image-default "alt=" Linux Chinese display garbled? How to set up CentOS display Chinese "/>

  7. 7

    After setting up, look at the previous garbled file again to see the display as Chinese

    650) this.width=650; "Src=" http://e.hiphotos.baidu.com/exp/w=500/sign=bb713de905082838680ddc148898a964/ 9922720e0cf3d7cae7c5a980f01fbe096b63a911.jpg "class=" Exp-image-default "alt=" Linux Chinese display garbled? How to set up CentOS display Chinese "/>


Reference http://jingyan.baidu.com/article/ab69b270de8b4f2ca7189f1d.html

This article is from the cloud blog, so be sure to keep this source http://weimouren.blog.51cto.com/7299347/1828140

Linux garbled problem and its solving method

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.