衫裤跑路 2010-03-23 12:27 采纳率: 50%
浏览 543
已采纳

如何修复来自 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").

How do I fix it?

转载于:https://stackoverflow.com/questions/2499794/how-to-fix-a-locale-setting-warning-from-perl

  • 写回答

30条回答 默认 最新

  • 三生石@ 2010-03-24 18:50
    关注

    Your OS doesn't know about 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").

    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 into new sessions the values of those environment variables.

    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
    %

    or with bash:

    $ LANG=C perl -e exit
    $ 

    For a permanent fix, choose one of

    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.)
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(29条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘