Linux Terminal Chinese display garbled

Source: Internet
Author: User
Tags i18n locale pack sublime text

Today, help our classmates to deal with the Chinese display garbled problem. This is a problem of domestic Linux users, because most of the Linux distribution is based on English, and English in the universality and stability is better than Chinese, a variety of strange bugs are less. Therefore, it is strongly recommended to use the English system.

We know that our operating system is not the Chinese version and English version, whether it is Windows or Linux, the system is released when the world is the same kernel, the system is presented to us in English or Chinese, it depends entirely on the language pack you choose. People from different countries choose their own country when installing the language pack, the language in the application is not written dead, it is based on the system's settings to invoke the relevant language, so an application written out without modification, users in different countries of the world can use it in a native language interface, This ratione materiae so-called internationalization (internationalization), referred to as i18n. This is also the future of software development trend.

So, if I install different language packs and different fonts in the system, how does the system judge the language interface I want and invoke the relevant font? What are the files and variables in the system controlling these?

You can use the locale command to view the character set used by the current system default

# locale

In the Redhat/centos system, the recording system default language file is/etc/sysconfig/i18n, if the default installation is the Chinese system, i18n content is as follows:

Lang= "ZH_CN. UTF-8 "sysfont=" Latarcyrheb-sun16 "supported=" ZH_CN. Utf-8:zh_cn:zh "

Where lang variable is the abbreviation of language, a slightly English-based user can see that the variable is the default language of the system, that is, the system's menu, the program's toolbar language, input method default language and so on. Sysfont is the abbreviation for system font, which determines which font is used by default. The supported variable determines the language that the system supports, i.e. the language that the system can display. It is necessary to note that since computers originate in English-speaking countries, English is always supported by default, regardless of the font you use, and regardless of the typeface, the text is included.


So how to display Chinese?

1. The system must install the Chinese language pack.

# yum-y Groupinstall Chinese-support

2, only the language pack is not enough, we have to set up the corresponding character set

# # Temporary Effective # export lang= "ZH_CN. UTF-8 "# Set to Chinese # export lang=" en_US. UTF-8 "# Set to English, I prefer this export lang=c## permanent, edit/etc/sysconfig/i18n (preferably reboot) lang=" ZH_CN. UTF-8 "# # or, edit the/etc/profile configuration file, add the following line of export lang=" ZH_CN. UTF-8 "# reload #. /etc/profile## viewing the current character Set # echo $LANG

OK, after the above settings, the terminal should be able to display Chinese.

3, SSH remote terminal garbled

If the SSH terminal is still garbled, then we also need to set the encoding of the terminal software.

Xshell:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/47/97/wKioL1P8qabTCKVMAANPFNFmFpw821.jpg "title=" 1.png " alt= "Wkiol1p8qabtckvmaanpfnfmfpw821.jpg"/>

SECURECRT:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/47/97/wKioL1P8qhiy0U1oAAGqEyPhekU133.jpg "title=" 1.png " alt= "Wkiol1p8qhiy0u1oaagqeypheku133.jpg"/>

4, if the terminal or Chinese garbled swollen?

To set up the SSH software, select a font that supports Chinese .


Linux <---> Windows need to modify files and then garbled each other.

Copy up often found Chinese display garbled. The reason is that the default file format in Windows is GBK (gb2312), and Linux is generally UTF-8. The more tedious way is to use the program to convert the content into UTF-8 encoded format under Windows, but it is rather cumbersome and encounters a file to go back to. Here's how to solve this problem once and for all in Linux, see how the file is encoded, and how to encode and convert the file.

The best way to avoid these problems is to unify the code . For text files, all are saved uniformly in UTF8 format, do not use Word, Notepad, recommended sublime text, or notepad++under Windows.



This article is from the "Share Your Knowledge" blog, so be sure to keep this source http://skypegnu1.blog.51cto.com/8991766/1545449

Linux Terminal Chinese display 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.