When I run perl
, I get the warning:
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset
Export the variable
$ export LANGUAGE=en_US.UTF-8
$ export LC_ALL=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ export LC_CTYPE=en_US.UTF-8
Next run
$ sudo locale-gen
$ sudo dpkg-reconfigure locales
When you run dpkg-reconfigure locales
it asks you to choose the locales, choose en_US.UTF-8 . If you run this by selecting all locales, it will take some time to configure.
Here is how to solve it on Mac OS Lion (10.7) or Cygwin (Windows 10):
Add the following lines to your bashrc or bash_profile on the host machine:
# Setting for the new UTF-8 terminal support in Lion
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
If you are using zsh, edit zshrc:
# Setting for the new UTF-8 terminal support in Lion
LC_CTYPE=en_US.UTF-8
LC_ALL=en_US.UTF-8
In Arch Linux using a UK keyboard / locale I had the following error:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.utf8"
Exporting my locales in /etc/profile
didn't fix it.
I did however fix this by editing /etc/locale.gen
& also enabling
the en_US.utf8
locale that perl
expected to find & running local-gen
.
(I use pac-manager which uses a whole bunch of perl
modules from AUR so reinstalling perl
in my particular case would be a nuisance)
This is a quick answer. We will set locales that are not unset after reboot. First open bash file and edit it :
nano .bashrc
add these lines to the file :
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"
activate change by reloading bash :
source ~/.bashrc
test results :
locale
I was getting the same warning while using Git
To resolve this warning Uncheck the Set locale environment variable on startup
option and restart your terminal. Below screen shot represents my terminal settings.
for me I fix this error editing the .bashrc file add export. Add after initial comments.
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
Kind Regads,