I just installed Red Hat Enterprise Edition 5 today. There are a lot of problems... open a browser and open the world. All these are mahjong-like square grids. Yes. The Chinese characters are not displayed properly.
Http://www.cnblogs.com/josson/archive/2006/04/06/368483.html
In Linux, locale is used to set different language Environments for running programs. locale is supported by ansi c. Locale naming rules are <language >_< region>. <character set encoding>, such as zh_CN.UTF-8, ZH stands for Chinese, CN stands for mainland China, and UTF-8 stands for character set. In the locale environment, there is a set of variables that represent different settings in the international environment:
1. lc_collate
Define sorting and comparison rules for the environment
2. lc_ctype
It is used for character classification and string processing to control the Processing Methods of all characters, including character encoding, whether the characters are single-byte or multi-byte, and how to print them. Is the most important environment variable.
3. lc_monetary
Currency format
4. lc_numeric
Non-currency Numeric Display format
5. lc_time
Time and date format
6. lc_messages
The language of the prompt message. There is also a language parameter, which is similar to lc_messages, But once this parameter is set, the lc_messages parameter will become invalid. The language parameter can be set to multiple languages at the same time, such as "zh_cn.gb18030: zh_cn.gb2312: zh_cn ".
7. Lang
The default value of LC _ * is the lowest level. If LC _ * is not set, this value is used. Similar to lc_all.
8. lc_all
It is a macro. If this value is set, this value will overwrite all the set values of LC. Note that the Lang value is not affected by this macro.
Example:
Before setting, use the default locale:
Debian :~ # Locale
Lang = "POSIX"
Lc_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"
Lc_all =
After setting, use zh_cn.gdk Chinese locale:
debian:~# export LC_ALL=zh_CN.GBK
debian:~# locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.GBK"
LC_NUMERIC="zh_CN.GBK"
LC_TIME="zh_CN.GBK"
LC_COLLATE="zh_CN.GBK"
LC_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
"C" is the default locale, and "POSIX" is the alias of "C. So when we install a new system, the default locale is C or POSIX.
To install locales in Debian, follow these steps:
· Use the apt-Get install locales command to install the locales package
· After the locales package is installed, the system automatically configures locale. You only need to select the desired locale. Specify the default locale. In this way, the system will automatically generate the corresponding locale and configure the system locale.
· Adding a new locale is also easy. Use dpkp-reconfigure locales to reconfigure locale.
· You can also manually add locale to add the new locale to the/etc/locale. gen file, and then run the locale-gen command to generate a new locale. You can set the locale of the system by setting the LC _ * variable described above. The following is an example of a locale. gen file.
· # This file lists locales that you wish to have built. You can find a list
· # of valid supported locales at /usr/share/i18n/SUPPORTED. Other
· # combinations are possible, but may not be well tested. If you change
· # this file, you need to rerun locale-gen.
· #
·zh_CN.GBK GBK
·zh_CN.UTF-8 UTF-8