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.


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:


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


  • good answer, john, thx. do you know what package adds the /var/lib/locales stuff? my recent Debian 5.0.3 install doesn't provide that, although an old Ubuntu 7.04 install did. – quack quixote Oct 14 '09 at 12:59
  • Debian's locale settings are in /etc/locale.gen I believe. – John T Oct 14 '09 at 14:00
  • hmmm. that looks like the stuff i selected during the dpkg-reconfigure locales, it's probably generated there. maybe the old Ubuntu install generated the /var/lib/locales stuff too, dpkg -S doesn't find an associated package. the Debian install does use the /etc/default/locale file for selecting system default. – quack quixote Oct 14 '09 at 14:59

If you also need to switch latin1 encoded filenames to utf-8, use convmv (apt-get install convmv):

convmv -f latin1 -t utf8 -r /path/to/files

This will only show what it would do. Add the --no-test option to actually do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.