Understanding terminal locales

0

I am looking into terminal customisation, and in particular text encodings. I understand the differences between the UTF-* encodings, and the differences between different encoding types, generally (e.g. ISO* to UTF-*, etc). However I don't quite understand their application to locales, or, for that matter, what particular locale settings are actually supposed to do.

If I type the command locale -a into my terminal I'm presented with a list of possible locales I can use:

af_ZA
af_ZA.ISO8859-1
af_ZA.ISO8859-15
af_ZA.UTF-8
am_ET
am_ET.UTF-8
be_BY
be_BY.CP1131
... <~200 line snip>
C
POSIX

If I select, for example, af_ZA.UTF-8, I can expect UTF-8 encoding in my terminal. That being the case, why does it matter that I have chosen af_ZA.UTF-8 rather than en_AU.UTF-8 (or fr_FR.UTF-8)? Isn't it all just UTF-8? What does the language/location part of the locale actually do?

Ephemera

Posted 2015-02-08T04:14:50.213

Reputation: 1 351

Answers

1

locales are used to specify much more than just the encoding type; they contain number, date/time, and money formats that vary from country to country. They can also account for collation and alphabetical idiosyncrasies from one place to another.

/usr/bin/locale is used by glibc, so any actual manifestations of its settings will be determined by the authors of the software that use it. People often want to write programs that calculate money or print a date, or sort a value, and have it come out right on everyone's PC, regardless of where in the world they are. By having your locale correctly set, these programs will display data correctly for you.

see more here: https://wiki.archlinux.org/index.php/Locale

Frank Thomas

Posted 2015-02-08T04:14:50.213

Reputation: 29 039