Problems with the Linux character set

Source: Internet
Author: User
Tags i18n locale

 Linux System login or remote operation or sometimes when we use man under the character terminal to view a command's description document, its contents may contain some garbled characters similar to "<A1><AE>". In this case, you can use the following command to eliminate garbled characters:
[email protected] ~]$ unset LANG
What is this problem? This would have to say a concept-the character set,
Why say the character set, quote a paragraph: "Locale is a very important concept in the process of internationalization and localization, personally, for Chinese users, usually involves the internationalization or localization, roughly contains three aspects: Reading Chinese, writing Chinese, and Compatibility and communication of Windows Chinese system. From practical experience, the setting of locale has little to do with Chinese, but it is closely related to writing Chinese, and the way of loading the window partition. "
 
• View Character Set
The character set is embodied in the system as an environment variable, taking Redhat as an example (Bshell) its view of the current terminal using the character set can be in the following ways:
1) [[email protected] ~] $env |grep LANG
lang=zh_cn.gb18030
2) [[email protected] ~]$ export |grep LANG
declare-x lang= "zh_cn.gb18030"
3) There is also a very powerful command: locale
[email protected] ~]$ 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=
It is shown above that lc_ctype (character identification code) indicates that the system used by the system now uses a character set of ZH_CN. Gb18030,lc_numeric (display messages for digital systems) and other language-related variables. Usually if the other language variables are not set, just set lang this variable can default to replace all other variables.
 
second, the way to modify the character set
If the default language is en_US. UTF-8, it is not possible to display and input Chinese in the Linux character and graphical interface. If the default language is Chinese, such as ZH_CN. GB18030 or zh_cn.gb2312, the character interface cannot be displayed and entered, the graphical interface can be.
There are two ways to modify this:
1). Change the way you set the variables directly, and command the following two commands:
[[email protected] ~] $LANG =xxx or export lang=xxx;
[[email protected] ~] $LC _all= "xxx" or export lc_all= "xxx";
Note: XXX is the character set you want to modify
The method of viewing the standard character set, locale–a commands, commonly used are zh_cn.gb2312,
ZH_CN. GB18030 or ZH_CN. UTF-8, en_US. UTF-8, etc.
However, the above modification will only take effect in the current shell. New shell This environment variable disappears
so usually login system execution "lang=" This command when the display is no garbled reason, meaning is to cancel the display of the character set, and the opening mentioned is a meaning
2), modify the file mode, by modifying the/etc/sysconfig/i18n file control
[email protected] ~]$ vi/etc/sysconfig/i18n
lang= "ZH_CN. GB18030 "#==> Here is the language of the system
supported= "ZH_CN. Utf-8:zh_cn. GB18030:zh_CN:zh:en_US. Utf-8:en_us:en "
sysfont= "Lat0-sun16"
modify file Save after exiting to take effect to execute the following command to be effective
[email protected] ~]$ source/etc/sysconfig/i18n
when the user logs in to the shell, it reads the set value
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.