解决ubuntu can't set the locale; make sure $LC_* and $LANG are correct的问题

首先查看哪个$LC_*不能设置

执行locale

xxx@kd:~/$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
LANGUAGE=zh_CN:zh
LC_CTYPE=zh_CN.utf8
LC_NUMERIC=zh_CN
LC_TIME=zh_CN
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY=zh_CN
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER=zh_CN
LC_NAME=zh_CN
LC_ADDRESS=zh_CN
LC_TELEPHONE=zh_CN
LC_MEASUREMENT=zh_CN
LC_IDENTIFICATION=zh_CN
LC_ALL=

 

上面的输出显示LC_CTYPE,LC_MESSAGES,LC_ALL不能设置,前两个对应的值是zh_CN.utf8,zh_CN.UTF-8

那么我们只需要locale-gen对应的值就行

xx@kd:~/$sudo locale-gen zh_CN.UTF-8
Generating locales...
  zh_CN.UTF-8... done
Generation complete.

 

 注:zh_CN.utf8和zh_CN.UTF-8是相同的值我们只需产生其中一个就行;LC_ALL是空值,当其他的值都设置好以后就不会出问题了

参考:http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue

posted @ 2013-02-20 18:52  skiloop  阅读(3302)  评论(0编辑  收藏  举报