https://stackoverflow.com/questions/2499794/how-to-fix-a-locale-setting-warning-from-perl
When I run perl
, I get the warning:
1 2 3 4 5 6 7 |
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?
Your OS doesn’t know about en_US.UTF-8
.
You didn’t mention a specific platform, but I can reproduce your problem:
1 2 3 4 5 6 7 8 9 |
% 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
1 2 |
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:
1 2 |
% env LANG=C perl -e exit % |
or with bash:
1 2 |
$ LANG=C perl -e exit $ |
For a permanent fix, choose one of
- 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 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.)