How to change your default locale on Ubuntu Linux
2011-08-08 00:21
393 查看
转自:http://blog.andrewbeacock.com/2007/01/how-to-change-your-default-locale-on.htm
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
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:
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/localand add the following line:
en_GB ISO-8859-1
Regenerate the supported locales
Run
sudo dpkg-reconfigure locales
Change the default locale
Edit
/etc/environmentand ensure the
LANGand
LANGUAGElines 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/localerather than
/etc/environment- Thanks Guy!
Reboot!
Rerun
localeto check that your default locale is now
en_GB
相关文章推荐
- How to Record Your Desktop Using FFmpeg on Ubuntu Linux
- How to Record your Voice from the Microphone on Ubuntu/Linux Mint
- How to Install Ubuntu Linux on your Dell PC
- How to install GIT on Linux (Ubuntu & CentOS)
- How to set up Eclipse with Android SDK on Ubuntu linux 9.04/9.10 (updated)
- How to build DHCP&NTP server on Linux(Ubuntu)
- How to Set Up an Rsync Daemon on Your Linux Server
- How to Find Your IP Address in Ubuntu Linux
- How to install GSL on linux (ubuntu)
- How to change the default run level of a RedHat 9.0 or Fedora Core Linux system
- How To Install Linux, nginx, MySQL, PHP (LEMP) stack on Ubuntu 12.04
- How to change the computer name on Ubuntu
- How to build DHCP&NTP server on Linux(Ubuntu)
- Install an RPM Package on Ubuntu Linux(from how to geek)
- Howto Enable and Use A2DP Sink on Ubuntu Linux with Bluez
- How to Install Oracle Java on Ubuntu Linux
- How To Install LAMP (Linux, Apache, MySQL, PHP) On Ubuntu 11.04/11.10/12.04
- How to change the default stack size on different platforms
- How to Install Oracle Java JDK on Ubuntu Linux
- How to Install Scala 2.9.1 on Linux (Ubuntu 11.04) ?