我在服务器 (Debian 7.5 stable (Wheezy) (64bits)) 上生成区域设置时遇到问题。当我以 root 身份运行时:
dpkg-reconfigure locales
并选择en_US.UTF-8
,我得到以下日志:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_GB:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_GB:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "C"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_GB:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "C"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
sh: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)
知道为什么吗?
谢谢你!
答案1
显然您已经LANGUAGE=en_GB:en
在您的环境中,但是您没有选择en_GB
或en
要生成其他变体(的第一部分dpkg-reconfigure locales
)。
您可能曾将en_GB
其作为旧默认设置,但现在已将其从要生成的语言环境列表中删除。但是您的环境仍具有旧设置,因此 perl 会抱怨它找不到(旧)语言环境。对于讲英语的人来说,这本身并不是问题,后备语言环境完全可读,因此实际上不是问题。
注销并再次登录将获取新设置,或者你可以这样做
source /etc/default/locale
从你的外壳。
某些应用程序可能并不总是具有适合您特定语言环境的本地化功能;在这种情况下,按如下方式启动此类应用程序可能会有所帮助,因为语言C
环境应该始终可用:
env LC_ALL=C applicationname