如何修复来自Perl的语言环境设置警告? [英] How to fix a locale setting warning from Perl?

查看:177
本文介绍了如何修复来自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.

您没有提到特定的平台,但是我可以重现您的问题:

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

  1. 在较旧的主机上,在外壳程序的初始化文件中设置LANG环境变量.
  2. 使用命令LANG=C ssh hunter2修改客户端环境,例如 ,而不是ssh hunter2.
  3. 如果您具有管理员权限,请通过注释 local /etc/ssh/ssh_config文件中的SendEnv LANG LC_*行来阻止ssh发送环境变量. (感谢这个答案.有关OpenSSH的更多信息,请参见 Bug 1285 . .)
  1. On the older host, set the LANG environment variable in your shell's initialization file.
  2. Modify your environment on the client side, e.g., rather than ssh hunter2, use the command LANG=C ssh hunter2.
  3. If you have admin 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆