[Read This Fine Material] from Joshua Hoblitt

Setting the default locale on Gentoo to UTF8 encoding

| 1 Comment

Gentoo has two good documents on dealing with UTF8 and localization that should be reviewed.

I decided to set my system wide default away from ANSI to UTF8 as gnome-terminal seems to inherit LANG from XDM and there doesn’t seem to be a way to tell it to ignore LANG and default to UTF8. This is really annoying since most RHEL5.x based distros default to UTF8. Here is a quick little shell snippet to set the locale to US/English/UTF8.

cat > /etc/locale.gen <<"END"
# /etc/locale.gen: list all of the locales you want to have on your system
# The format of each line:
# <locale> <charmap>
# Where  is a locale located in /usr/share/i18n/locales/ and
# where  is a charmap located in /usr/share/i18n/charmaps/.
# All blank lines and lines starting with # are ignored.
# For the default list of supported combinations, see the file:
# /usr/share/i18n/SUPPORTED
# Whenever glibc is emerged, the locales listed here will be automatically
# rebuilt for you.  After updating this file, you can simply run `locale-gen`
# yourself instead of re-emerging glibc.
en_US.UTF-8 UTF-8
en_US ISO-8859-1
echo "LANG=en_US.utf8" > /etc/env.d/02locale
source /etc/profile

One Comment

  1. That shoul be be en_US.UTF-8 (not utf8) on the line after local-gen.
    Thanks this helped me switch locale 🙂

Leave a Reply