up vote 0 down vote favorite
1
share [g+] share [fb]

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.

link|improve this question

75% accept rate
feedback

2 Answers

up vote 4 down vote accepted

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.

link|improve this answer
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
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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