跳过正文

perl: warning: Setting locale failed

Tech Perl
浮世絵空事
作者
浮世絵空事
所谓灵魂 几行代码

Copy from: http://stackoverflow.com/questions/2499794/how-to-fix-a-locale-setting-warning-from-perl

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
$