Chinaunix首页 | 论坛 | 博客
  • 博客访问: 19979
  • 博文数量: 3
  • 博客积分: 229
  • 博客等级: 入伍新兵
  • 技术积分: 40
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-07 13:53




2010-11-30 14:19:06

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 () 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 (编者注: sudo locale-gen)

Change the default locale
Edit /etc/environment and ensure the LANG and LANGUAGE lines read as follows:

UPDATE '09: An old collegue has suggested that this change should now be made in /etc/default/locale rather than /etc/environment - Thanks Guy!


Rerun locale to check that your default locale is now en_GB
阅读(2701) | 评论(0) | 转发(0) |