418ea1234937a344.jpg

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"

1 对 “centos6.5服务器中文乱码/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)”的想法;

  1. 验证:

    [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=
    
    

回复 admin 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code