如何从Perl修复语言环境设置警告 [英] How to fix a locale setting warning from Perl
本文介绍了如何从Perl修复语言环境设置警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我运行 perl
时,我得到警告:
When I run perl
, I get the warning:
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
.
您没有提到特定的平台,但是我可以重现您的问题:
You didn't mention a specific platform, but I can reproduce your problem:
% 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
包含
My guess is you used ssh to connect to this older host from a newer desktop machine. It's common for /etc/ssh/sshd_config
to contain
AcceptEnv LANG LC_*
这允许客户端将这些环境变量的值传播到新的会话中.
which allows clients to propagate the values of those environment variables into new sessions.
如果您不需要完整的语言环境,则警告会提示您如何消除它:
The warning gives you a hint about how to squelch it if you don't require the full-up locale:
% env LANG=C perl -e exit
%
或使用Bash:
$ LANG=C perl -e exit
$
要永久修复,请选择以下其中一项
For a permanent fix, choose one of
- 在较旧的主机上,在外壳程序的初始化文件中设置
LANG
环境变量. - 使用命令
LANG = C ssh hunter2
修改客户端环境 eg ,而不是ssh hunter2
.>li> - 如果您具有管理员权限,请通过注释 local
/etc/ssh/中的
文件.(感谢这个答案.有关OpenSSH的更多信息,请参见 Bug 1285 ..)SendEnv LANG LC _ *
行来停止ssh发送环境变量ssh_config
- On the older host, set the
LANG
environment variable in your shell's initialization file. - Modify your environment on the client side, e.g., rather than
ssh hunter2
, use the commandLANG=C ssh hunter2
. - If you have administrator rights, stop ssh from sending the environment variables by commenting out the
SendEnv LANG LC_*
line in the local/etc/ssh/ssh_config
file. (Thanks to this answer. See Bug 1285 for OpenSSH for more.)
这篇关于如何从Perl修复语言环境设置警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文