One problem that has repeatedly cropped up when developing in Java is strange error messages in our unit tests for certain text manipulation tests when running on a freshly installed Ubuntu desktop.
They are all related to Ubuntu's default British locale:
This was causing files checked out of CVS to be in Unicode (UTF-8) format rather than ISO-8859-1 and so the British pound sign (£) was being encoded as a double-byte (rather than single-byte) character in the file.
To check which locale you currently have as your default just run:
Changing the default locale is a little different on Ubuntu compared to most Linux distros, these are the steps we needed to go through to get it changed:
Add the locale to the list of 'supported locales'
Edit
Regenerate the supported locales
Run
Change the default locale
Edit
UPDATE '09: An old collegue has suggested that this change should now be made in
Reboot!
Rerun
Technorati Tags: Ubuntu, Linux, Locale, Unicode, UTF8, Andrew Beacock
They are all related to Ubuntu's default British locale:
en_GB.UTF-8
This was causing files checked out of CVS to be in Unicode (UTF-8) format rather than ISO-8859-1 and so the British pound sign (£) was being encoded as a double-byte (rather than single-byte) character in the file.
To check which locale you currently have as your default just run:
locale
Changing the default locale is a little different on Ubuntu compared to most Linux distros, these are the steps we needed to go through to get it changed:
Add the locale to the list of 'supported locales'
Edit
/var/lib/locales/supported.d/local
and add the following line:en_GB ISO-8859-1
Regenerate the supported locales
Run
sudo dpkg-reconfigure locales
Change the default locale
Edit
/etc/environment
and ensure the LANG
and LANGUAGE
lines read as follows:LANG="en_GB"
LANGUAGE="en_GB:en"
UPDATE '09: An old collegue has suggested that this change should now be made in
/etc/default/locale
rather than /etc/environment
- Thanks Guy!Reboot!
Rerun
locale
to check that your default locale is now en_GB
Technorati Tags: Ubuntu, Linux, Locale, Unicode, UTF8, Andrew Beacock
Comments
I've installed Kubuntu onto a laptop with a US keyboard, hence I believe the Kubuntu installer configured linux to the en_US locale. I've followed the configuration instructions you mentioned to change locales (I guess it would be similar under Kubuntu), however, my LANG variable is still set as en_US.UTF-8 as are a number of other LC vars. The only change is that of the addition of a LANGUAGE var which is set to en_GB:en. Any idea where these other settings are configured and how I can get them changed?
Thanks,
Andy.
that will fix your problem
I set (in Kubuntu) country or region to Tanzania and language to british english.
Spell checking in kmail etc was using US spelling and open office use $ for currency.
I have a file /etc/environment that says
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
LANG="en_US.UTF-8"
and a file /etc/default/locale which says
LANG="en_US.UTF-8"
the locale command lists everything based on en_US
Wouldn't it be good if the GUI settings actually worked and set things as I wanted!
That worked out well.
Thanks for this information!
Solved a problem with a stubbornly German Hotel booking program, CultBooking.
Cheers
My two cents are that, as far as Ubuntu Hardy, I also needed to change
/etc/default/locale
Regards.
I don't any more - your suggestion worked where others didn't.
thanks a lot. Anyway, the reboot is not needed.
Ciao,
Andrea
locale-gen en_GB
update-locale LANG=en_GB.ISO-8859-1
I recommend UTF-8 and here's what I used:
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8
I did not need to reboot, but I did need to log out and log back in again before the output of "locale" reflected the changes. The reboot might be necessary for background processes to reload the new information.
locale-gen en_GB
update-locale LANG=en_GB.ISO-8859-1
I needed pull some sinhala BLOB data from db, finally did it through above update.
Thnx Daniel....
inside .profile or .bash_profile in the users home directory:
LANG=en_US.ISO-8859-1
Then logout and back in.
locale
echo $LANG
confirm that it has been successful
Moreover, if anyone needs legal locale codes, are in:
/usr/share/i18n/SUPPORTED
cat /var/lib/locales/supported.d/local
Does the desired locale exist in there? If not then create it with
sudo locale-gen en_GB.UTF-8
It will genetate the locale and update the list of supported locales. Now change the default locale with
sudo update-locale LANG=en_GB.UTF-8
It updates the contents of /etc/default/locale. Log out and back in again. You can check that it has taken affect by typing locale
This will ask you which locales you wish to generate, and which of those you want to be the default.
Problem fixed.
Thank you so much!
locale-gen de_DE
update-locale LANG=de_DE@euro
you solved my problem as well !
for Egypt/Arabic use ar_EG
Etienne