方法二:
# localeLANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"# locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"ENTIFICATION="zh_CN.UTF-8"
LC_A
安装完成之后通过vi命令修改配置文件:
这个是由中文字符集改为英文字符集,没办法中文字符集还是存在乱码问题;
#vi /etc/locale.conf# LANG="zh_CN.UTF-8"
LANG="en_US.UTF-8"
改完后需要使用source命令是配置文件生效:
#source /etc/locale.conf检查:
# 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=
临时改变字符集命令:
#LANG="想要使用的字符集"
#LANG="LANG=en_US.UTF-8"
也可以把字符集的环境变量写到profile
# vim /etc/profile注意这个需要利用#source /etc/profile使文件生效。
根据用户设置字符集,需要更改用户家目录下的 .bash_profile ,在最后一行添加字符集就可以了
# vim .bash_profile
LANG="LANG=en_US.UTF-8"
使用远程连接工具时注意把字符集调试成与系统字符集一致。
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx