centos7 修改中文字符集

CentOS 7字符集的問題與6有點區別,會出現下面問題,查看是中文,vi進入就變成亂碼了

直接說我生產中使用的吧

修改配置文件

[root@ce1d2002a999 ~]# cat /etc/locale.conf 
LANG="zh_CN.UTF-8"

改爲中文字符集

然後在查看更改後的系統語言變量

[root@5c46832b5c01 ~]# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
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=

查看語言包

[root@5c46832b5c01 ~]# locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
POSIX
en_US.utf8

發現沒有中文,安裝一個,注意7跟6不一樣

# yum install kde-l10n-Chinese
#yum reinstall glibc-common

再次查看

[root@ce1d2002a999 ~]# cat test  
我的意思是
[root@ce1d2002a999 ~]# vi test 

我的意思是

更改完畢!!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章