how to fix locale error

An Ubuntu desktop should be set up with UTF-8 encoding. For some reason your system tries to set the latin1 locale en_US.ISO-8859-1. You should really change that.

Maybe the setting takes place in /etc/default/locale.

Whereever it happens, change it to

LANG=en_US.UTF-8

or else you will encounter various locale related surprises.


The permanent solution of locale issue is by exporting the locale variables in .bash_profile file. You can also use /etc/profile file instead of .bash_profile.

echo "export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8">>~/.bash_profile

Don't forget to source the .bash_profile and follow the script in easy setup.

Here is the script which fix the locale issue


The debootstrap doesn't create a locale. So we use something else as a locale. Use this command:

sudo locale-gen en_US.ISO-8859-1

I hope this helps!