
我在我的伺服器(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