Change the default codepage from latin1 to utf8 on a linux machine

How can I change the default codepage/charset on a linux system from latin1 to utf8? I need to do this on two systems, one is running Ubuntu and the other Debian.


Solution 1:

Edit /var/lib/locales/supported.d/local and add your locale to the list of supported locales if it isn't there already, eg:

en_US UTF-8

Regenerate the supported locales on your machine:

sudo dpkg-reconfigure locales

Open /etc/default/locale and check if LANG and LANGUAGE are changed:

LANG="en_US"
LANGUAGE="en_US:UTF-8"

if they are not, you can manually update them now.

reboot.