当我运行时perl,我收到警告:
perl
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").
我如何解决它?
您的操作系统不知道en_US.UTF-8.
en_US.UTF-8
您没有提到特定平台,但我可以重现您的问题:
% uname -a OSF1 hunter2 V5.1 2650 alpha % perl -e exit perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LC_ALL = (unset), LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").
我的猜测是您使用 ssh 从较新的台式机连接到这台较旧的主机。/etc/ssh/sshd_config包含是很常见的
/etc/ssh/sshd_config
AcceptEnv LANG LC_*
这允许客户端将这些环境变量的值传播到新会话中。
如果您不需要完整的语言环境,该警告会提示您如何压制它:
% env LANG=C perl -e 退出 %
或使用 Bash:
$ LANG=C perl -e 退出 $
对于永久修复,请选择以下之一
LANG
ssh hunter2
LANG=C ssh hunter2
SendEnv LANG LC_*