Enable RedHat Linux to display Chinese characters directly
Source: Internet
Author: User
I believe that even good English friends are more accustomed to reading Chinese. Fortunately, thanks to the efforts of many people, Linux's support for Chinese is getting better and better. For example, if I use Red Hat 6.2 without any patches, I can directly display Chinese characters in the menu, title bar, and other places through some settings. I believe that other Linux releases can display Chinese characters through similar settings.
Next, I will take Red Hat 6.2 as an example to briefly describe the configuration steps.
1. Determine the version of libc you are using.
Libc is the gnu c function library, including libc 5 and libc 6. Most of the early Linux release kits were libc 5, such as Slackware. Currently, almost all the release kits are upgraded to libc 6, that is, glibc 2, which can basically process Chinese characters normally. If the/lib directory contains libc. in the so.6 file, you can confirm that the libc version is glibc 2. Otherwise, your libc version is too old. We recommend that you upgrade to the latest glibc 2.2 Immediately. For the upgrade method, refer to the HOWTO of glibc 2.
2. Check the font installation
To display Chinese characters, you must have a Chinese font. Run the following command in Shell:
$ Xlsfonts | grep gb
-Isas-fangsong ti-medium-r-normal -- 0-0-72-72-c-0-gb2312.1980-0
-Isas-song ti-medium-r-normal -- 0-0-72-72-c-0-gb2312.1980-0
Hanzigb16fs
Hanzigb16st
If there is a result output similar to the above, it indicates that the font of simplified Chinese characters is installed in the system, you can directly set the next step; if there is no output, we need to install additional fonts. You can download and install the GB font on the Internet. Red Hat Linux 6.2 has two built-in fonts: and. You do not need to install them separately.
3. Define regional language settings
In/usr/share/locale, the language settings in different regions of the system are stored. We can see that there is a directory named zh_cn.gb2312, but there is no necessary information below, we can go to the/usr/share/i18n directory, where the code and conversion information of various languages are stored separately, we need to find the charmaps/gb2312, locales/zh_cn.gb2312, and repertoiremaps/charids.894 files. However, due to glibc 2.1's incomplete support for double-byte text, modify the zh_cn.gb2312 file. This is a text file. First, comment out the second line with "%", and then it is a tedious step. Change the definitions of lc_monetary, lc_time, and lc_messages in the file to English, as shown below:
Lc_monetary
CP from en_dk
End_monetary
After modification, run the following command:
$ Localedef-I zh_cn.gb2312-F gb2312-u charids.894 zh_cn.gb2312
The system will generate region settings in the/usr/share/locale/zh_cn.gb2312 directory. If you are careful, you must note that the GB is in lower case. This is not my mistake. This is the case; we also need to move the corresponding content to the zh_cn.gb2312 directory.
$ MV zh_cn.gb2312/zh_cn.gb2312
4. modify the system encoding and conversion settings to tell the system how to convert the Chinese character encoding to the system internal code.
Find the EUC-CN string in the/usr/lib/gconv-modules file, around the location of line 880, and confirm that there is a line of gb2312 information, as shown in the third line below:
# From to module cost
Alias euccn // EUC-CN //
Alias gb2312 // EUC-CN //
Alias CN-GB // EUC-CN //
Module EUC-CN // internal EUC-CN 1
Module Internal EUC-CN // EUC-CN 1
5. xfree86 settings
/Usr/x11r6/lib/X11/locale is the directory where xfree86 stores region information. The zh/xlc_locale file is the Chinese font set information. Add the following line to the locale. dir file:
Zh/xlc_locale zh_cn.gb2312
Of course, it is better to create a directory named zh_cn.gb2312, copy the zh/xlc_locale file to this directory, and change locale. dir:
Zh_cn.gb2312/xlc_locale
Zh_cn.gb2312
6. Set Environment Variables
Everything is ready. You only need to tell the system to set the region in Chinese. Enter the following setting command in shell:
$ Lang = zh_cn.gb2312
OK. Now, go back to the X-window system. You should be able to see the familiar Chinese! Is it cool?
It is worth mentioning that the newly released KDE 2.0 and gnome1.2 both provide complete Chinese information. Please upgrade them now! From: Osso
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