Linux locale: en_US.UTF-8 vs en_US

linuxlocalizationshellUbuntu

I usually config my ubuntu via

sudo locale-gen --purge en_US.UTF-8

And I've the installed locales

# locale -a
C
C.UTF-8
en_US.utf8
POSIX

Is it okay since I am missing en_US?

Best Answer

Yes, you're probably quite fine. Assuming en_US.utf8 contains a UTF-8 American/English locale, it should work just fine. That's what I use myself:

% echo $LANG
en_US.UTF-8

If you run locale -v -a, it'll be a bit more descriptive:

% locale -v -a
locale: en_US           archive: /usr/lib64/locale/locale-archive
-------------------------------------------------------------------------------
    title | English locale for the USA
   source | Free Software Foundation, Inc.
  address | http://www.gnu.org/software/libc/
    email | bug-glibc-locales@gnu.org
 language | English
territory | USA
 revision | 1.0
     date | 2000-06-24
  codeset | ISO-8859-1

locale: en_US.utf8      archive: /usr/lib64/locale/locale-archive
-------------------------------------------------------------------------------
    title | English locale for the USA
   source | Free Software Foundation, Inc.
  address | http://www.gnu.org/software/libc/
    email | bug-glibc-locales@gnu.org
 language | English
territory | USA
 revision | 1.0
     date | 2000-06-24
  codeset | UTF-8

The only difference between en_US and en_US.utf8 is that the former uses ISO-8859-1 for a character set, while the latter uses UTF-8. Prefer UTF-8. The only difference in these is in what characters they are capable of representing. ISO-8859-1 represents characters common to many Americans (the English alphabet, plus a few letters with accents), whereas UTF-8 encodes all of Unicode, and thus, just about any language you can think of. UTF-8, today, is a defacto standard encoding for text. (Which is why you should prefer it.)