Chinaunix首页 | 论坛 | 博客
  • 博客访问: 576097
  • 博文数量: 836
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 4995
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-22 16:55
文章分类

全部博文(836)

文章存档

2008年(836)

我的朋友

分类: LINUX

2008-08-22 17:40:11

 
系统:英文版的Redhat企业版
症状:英文显示没问题;中文输入法也没问题;中文网页显示为乱码,不管是用GB18030还是2312
解决:安装fonts-chinese-3.02-9.6.el5.

此时相关如下:
[root@localhost~]#rpm-qa|grepfonts-|wc-l
14
[root@localhost~]#rpm-qa|grepfonts-
bitmap-fonts-0.3-5.1.1
xorg-x11-fonts-misc-7.1-2.1.el5
fonts-chinese-3.02-9.6.el5
xorg-x11-fonts-base-7.1-2.1.el5
xorg-x11-fonts-75dpi-7.1-2.1.el5
urw-fonts-2.3-6.1.1
xorg-x11-fonts-100dpi-7.1-2.1.el5
bitstream-vera-fonts-1.10-7
ghostscript-fonts-5.50-13.1.1
xorg-x11-fonts-ISO8859-1-75dpi-7.1-2.1.el5
xorg-x11-fonts-Type1-7.1-2.1.el5
xorg-x11-fonts-ISO8859-1-100dpi-7.1-2.1.el5
dejavu-lgc-fonts-2.10-1
xorg-x11-fonts-truetype-7.1-2.1.el5
[root@localhost~]#cat/etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
[root@localhost~]#locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
[root@localhost~]#

网上提供的消除中文乱码的方法如下,只是一种治标的方法,应该是先查看有没有相关的字体包已经安装,再考虑更改如下设置:

将i18n内容改为

LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en"
SYSFONT="lat0-sun16"

------------------------------------

下述命令如果有下述信息说明装有中文字体:


[root@localhost~]#xlsfonts|grepgb
-isas-fangsongti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0
-isas-songti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0
-isas-songti-medium-r-normal--24-240-72-72-c-240-gb2312.1980-0
-misc-arplshanheisununi-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
-misc-arplzenkaiuni-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
-misc-zysong18030-medium-r-normal--0-0-0-0-c-0-gb18030.2000-0
-misc-zysong18030-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
-misc-zysong18030-medium-r-normal--0-0-0-0-c-0-gbk-0
-urw-dingbats-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
hanzigb16fs
hanzigb16st
hanzigb24st

字体所在目录:/usr/share/locale


[root@localhost~]#cd/usr/share/locale
[root@localhostlocale]#ll

................................................

drwxr-xr-x4rootroot4096Dec142006zh_CN
drwxr-xr-x3rootroot4096Sep2617:38zh_CN.GB2312
drwxr-xr-x3rootroot4096Sep2617:31zh_HK
drwxr-xr-x4rootroot4096Dec142006zh_TW
drwxr-xr-x3rootroot4096Sep2617:38zh_TW.Big5
drwxr-xr-x3rootroot4096Sep2617:31znd
drwxr-xr-x3rootroot4096Sep2617:31zu
drwxr-xr-x3rootroot4096Sep2617:31zun

[root@localhostlocale]#cdzh_CN
[root@localhostzh_CN]#ll
total16
drwxr-xr-x2rootroot4096Oct1211:35LC_MESSAGES
drwxr-xr-x2rootroot4096Sep2617:35LC_TIME
[root@localhostzh_CN]#

LC_MESSAGES目录中是MO(MachineObject)files,可以理解为中文库文件,示例如下:
[root@localhostzh_CN]#cdLC_MESSAGES/
[root@localhostLC_MESSAGES]#msgunfmtbindconf.mo-o/tmp/ttt.po
[root@localhostLC_MESSAGES]#
[root@localhostLC_MESSAGES]#cat/tmp/ttt.po|more
msgid""
msgstr""
"Project-Id-Version:zh_CN\n"
"Report-Msgid-Bugs-T\n"
"POT-Creation-Date:2007-09-1109:59 0800\n"
"PO-Revision-Date:2005-12-0711:33 1000\n"
"Last-Translator:\n"
"Language-Team:\n"
"MIME-Version:1.0\n"
"Content-Type:text/plain;charset=UTF-8\n"
"Content-Transfer-Encoding:8bit\n"
"X-Generator:KBabel1.9.1\n"

msgid""
"\n"
"\n"
"\n"
"\n"
"\n"
msgstr""
"\n"
"\n"
"\n"
"\n"
"\n"

msgid""
"\n"
"Notethatenablingtheupdateforwardingfeatureonaslaveservermay"
"exposemasterserversrelyingoninsecureIPaddressbasedaccesscontrolto"
"attacks."
msgstr""
"\n"
"请注意,在一个从服务器上启用更新转发功能可能会使那些依赖基于访问控制的不安全"
"的IP地址的主服务器受到恶意攻击。"
----more----
定义区域语言的配置文件位置:

[root@localhost~]#cd/usr/share/i18n/
[root@localhosti18n]#ll
total32
drwxr-xr-x2rootroot12288Sep2617:31charmaps
drwxr-xr-x2rootroot12288Sep2617:31locales
[root@localhosti18n]#llcharmaps/GB*
-rw-r--r--1rootroot472428Jan152007charmaps/GB18030.gz
-rw-r--r--1rootroot1603Jan152007charmaps/GB_1988-80.gz
-rw-r--r--1rootroot44803Jan152007charmaps/GB2312.gz
-rw-r--r--1rootroot119113Jan152007charmaps/GBK.gz

[root@localhosti18n]#lllocales/zh_*
-rw-r--r--1rootroot5618Jan152007locales/zh_CN
-rw-r--r--1rootroot5851Jan152007locales/zh_HK
-rw-r--r--1rootroot6102Jan152007locales/zh_SG
-rw-r--r--1rootroot5605Jan152007locales/zh_TW
以前还有/usr/share/i18n/repertoiremaps目录和其中相关的配置文件,现在已经不用。

[root@localhosti18n]#manlocaledef用来生成区域设置

修改系统编码变换设置,告诉系统如何将汉字编码转换为系统内部码:

[root@localhost~]#locategconv-modules//查找配置文件位置
/usr/lib/gconv/gconv-modules
/usr/lib/gconv/gconv-modules.cache


XFree86设置:

[root@localhost~]#locatelocale.dir
/usr/share/X11/locale/locale.dir

环境变量的设置:

[root@localhost~]#echo$LANG//这是我电脑上的配置
en_US.UTF-8

阅读(284) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~