centos6.5服务器中文乱码/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

  sre

centos6.5服务器中文乱码,任何命令都会报错
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

#查看支持的中文
[root@test]# locale -a |grep zh
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
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
zh_HK
zh_HK.big5hkscs
zh_HK.utf8
zh_SG
zh_SG.gb2312
zh_SG.gbk
zh_SG.utf8
zh_TW
zh_TW.big5
zh_TW.euctw
zh_TW.utf8

#/etc/sysconfig/i18n信息,字符集不对造成的
LC_ALL=”en_US.UTF-8″
SYSFONT=”latarcyrheb-sun16″

改为以下即可:
LANG=”zh_CN.UTF-8″
LC_ALL=”zh_CN.UTF-8″

One Reply to “centos6.5服务器中文乱码/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)”

  • 验证:

    [root@test test]# 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.utf8
    LC_CTYPE="zh_CN.utf8"
    LC_NUMERIC="zh_CN.utf8"
    LC_TIME="zh_CN.utf8"
    LC_COLLATE="zh_CN.utf8"
    LC_MONETARY="zh_CN.utf8"
    LC_MESSAGES="zh_CN.utf8"
    LC_PAPER="zh_CN.utf8"
    LC_NAME="zh_CN.utf8"
    LC_ADDRESS="zh_CN.utf8"
    LC_TELEPHONE="zh_CN.utf8"
    LC_MEASUREMENT="zh_CN.utf8"
    LC_IDENTIFICATION="zh_CN.utf8"
    LC_ALL=
    
    

LEAVE A COMMENT

Captcha Code