1. LightDM uses `locale -a` command to get the list of available locales in function update_languages() (liblightdm-gobject\language.c line 52).
2. `locale -a` returns the simplified locale name (zh_CN.utf8) instead of the full locale name (zh_CN.UTF-8).
3. `locale -a` returns the simplified locale name because it reads it from the locale archive in function write_archive_locales() (http://repo.or.cz/glibc.git/blob/HEAD:/locale/programs/locale.c#l634).
4. The simplified name is used in locale archive because it is being 'normalized' when adding a locale to the archive. Function add_locale_to_archive() (http://repo.or.cz/glibc.git/blob/HEAD:/locale/programs/locarchive.c#l1130) calls function _nl_normalize_codeset() (http://repo.or.cz/glibc.git/blob/HEAD:/intl/l10nflist.c#l299) which normalizes the codeset name. Codeset names are normalized by that function to all-lowercase with all non-alphanumeric characters stripped i.e. "UTF-8" turns into "utf8".
I believe that it should be fixed in glibc. I think that function add_locale_to_archive() should store the locale with unnormalized codeset and then add an alias for its name with normalized codeset.
Until the fix will be accepted to glibc (if ever), it can be fixed in LightDM as well: by simply replacing '.utf8' with '.UTF-8' in locale names obtained from `locale -a` command before adding them to languages list (liblightdm-gobject\language.c line 80).
1. LightDM uses `locale -a` command to get the list of available locales in function update_languages() (liblightdm- gobject\ language. c line 52). locales( ) (http:// repo.or. cz/glibc. git/blob/ HEAD:/locale/ programs/ locale. c#l634). to_archive( ) (http:// repo.or. cz/glibc. git/blob/ HEAD:/locale/ programs/ locarchive. c#l1130) calls function _nl_normalize_ codeset( ) (http:// repo.or. cz/glibc. git/blob/ HEAD:/intl/ l10nflist. c#l299) which normalizes the codeset name. Codeset names are normalized by that function to all-lowercase with all non-alphanumeric characters stripped i.e. "UTF-8" turns into "utf8".
2. `locale -a` returns the simplified locale name (zh_CN.utf8) instead of the full locale name (zh_CN.UTF-8).
3. `locale -a` returns the simplified locale name because it reads it from the locale archive in function write_archive_
4. The simplified name is used in locale archive because it is being 'normalized' when adding a locale to the archive. Function add_locale_
See this: http:// unix.stackexcha nge.com/ questions/ 186963/ what-is- the-proper- encoding- name-to- use-in- locale- for-utf- 8
Notice that the answer author apparently did not understand the mail he is citing (https:/ /bugs.debian. org/cgi- bin/bugreport. cgi?bug= 607138# 79).
I believe that it should be fixed in glibc. I think that function add_locale_ to_archive( ) should store the locale with unnormalized codeset and then add an alias for its name with normalized codeset.
Until the fix will be accepted to glibc (if ever), it can be fixed in LightDM as well: by simply replacing '.utf8' with '.UTF-8' in locale names obtained from `locale -a` command before adding them to languages list (liblightdm- gobject\ language. c line 80).