Fixing Perl Locale Errors in a Clean Ubuntu Install

From KoanSoftware Wiki
Jump to: navigation, search

When performing various actions on a clean install of Ubuntu, I kept being presented with the following message:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
  LANGUAGE = "en_US:en",
  LC_ALL = (unset),
  LANG = "en_US.UTF-8"
  are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Solution #1 (easy):

sudo locale-gen
sudo dpkg-reconfigure locales

Solution #2 (the solution that worked for me):

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
sudo locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales

You might need to reset your machine before changes take effect.

If the settings above don't work, please edit your ~/.bashrc and add

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8