转载自:http://www.cnblogs.com/shipfi/archive/2008/04/10/1146434.html,谢谢!
Linux中语言的设置和本地化设置真是一个很繁琐的事情,时不时的会出现乱码的情况,在这篇文章中讨论的是shell中出现乱码的一些解决方法.
一般来说,linux中显示什么语言是通过环境变量来确认的. 这些环境变量包括:可以把以这些命令加入到~/.bash_profile文件中,这样,就成了默认配置.
或修改登录用户的.bash_profile文件加入
export LANG=zh_CN.GB18030
export LANGUAGE=zh_CN.GB18030:zh_CN.GB2312:zh_CN
SYSFONT="latarcyrheb-sun16"
============================
小总结一下:
1.Change current Terminal Shell
Scope: It's only available in specified shell.
Reboot: No.
>$ export LANG=zh_CN.utf8
>$ export LC_ALL=zh_CN.utf8
2.Change the language file
Scope: Change the locale in /etc/sysconfig/i18n file. All Linux System will use the specified locale.
Reboot: Yes.
LANG="zh_CN.UTF8"
SYSFONT="latarcyrheb-sun16"
3.Change the User's bash profile
Scope: Change the locale in ~/.bash_profile or ~/.bashrc. All Linux System will use the specified locale.
Reboot: Yes.
>$ export LANG=zh_CN.UTF8
>$ export LANGUAGE=zh_CN.UTF8:zh_CN.GB2312:zh_CN.db18030:zh_CN