2012年(21)
分类: LINUX
2012-11-08 10:07:19
1)Ubuntu上安装中文包
aptitude install language-pack-zh-base language-pack-zh
2)更新字符集配置
locale-gen zh_CN.GBK
dpkg-reconfigure locales
如上图所示,配置正确。须有zh_CN.GBK出现。
3)增加OS字符集
vi /etc/locale.alias
添加如下内容:
zh_Tw.big5 big5
zh_TW.UTF-8 UTF-8
en_US.UTF-8 UTF-8
en_AU.UTF-8 UTF-8
en_BW.UTF-8 UTF-8
en_CA.UTF-8 UTF-8
en_DK.UTF-8 UTF-8
en_GB.UTF-8 UTF-8
en_HK.UTF-8 UTF-8
en_IE.UTF-8 UTF-8
en_IN UTF-8
en_NZ.UTF-8 UTF-8
en_PH.UTF-8 UTF-8
en_SG.UTF-8 UTF-8
en_ZA.UTF-8 UTF-8
en_ZW.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_HK.UTF-8 UTF-8
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.GB18030:zh_CN:zh"
SYSFONT="lat0-sun16"
SYSFONTACM="8859-15"
4)初始化OS GBK字符集
locale-gen zh_CN.GBK
如图显示
5)配置GBK字符集环境变量
vi /etc/profile
添加如下内容:
export LC_ALL=zh_CN.GBK
export LANG=zh_CN.GBK
vi /etc/environment
添加如下内容:
LC_ALL="zh_CN"
LC_CTYPE="GB2312"
LANG="zh_CN.GB2312"
export LC_ALL = "C"