freebsd-skq/lib/libc/locale
Baptiste Daroussin d79cdd21de libc: Fix (and improve) nl_langinfo (CODESET)
The output of "locale charmap" is identical to the result of
nl_langinfo (CODESET) for any given locale.  The logic for returning the
codeset was very simplistic.  It just returned portion of the locale name
after the period (e.g. en_FR.ISO8859-1 returned "ISO8859-1").

When softlinks were added to locales, this broke.  e.g.:
   en_US returned ""
   en_FR.UTF8 returned "UTF8"
   en_FR.UTF-8 returned "UTF-8"
   zh_Hant_HK.Big5HKSCS returned "Big5HKSCS"
   zh_Hant_TW.Big5 returned "Big5"
   es_ES@euro returned ""

In order to fix this properly, the named locale cannot be used to
determine the encoding.  This information was almost available in the
rune data.  Unfortunately, all the single byte encodings were listed
as "NONE" encoding.

So I adjusted localedef tool to provide more information about the
encoding.  For example, instead of "NONE", the LC_CTYPE used by
fr_FR.ISO8859-15 is now encoded as "NONE:ISO8859-15".  The locale
handlers now check if the first four characters of the encoding is
"NONE" and if so, treats it as a single-byte encoding.

The nl_langinfo handling of CODESET was adjusting accordingly.  Now the
following is returned:
   en_US returns "ISO8859-1"
   fr_FR.UTF8 returns "UTF-8"
   fr_FR.UTF-8 returns "UTF-8"
   zh_Hant_HK.Big5HKSCS returns "Big5"
   zh_Hant_TW.Big5 returns "Big5"
   es_ES@euro returns "ISO8859-15"

as before, "C" and "POSIX" locales return "US-ASCII".  This is a big
improvement.  The result of nl_langinfo can never be a zero-length
string and it will always exclusively one of the values of the
character maps of /usr/src/tools/tools/locale/etc/final-maps.

Submitted by:	marino
Obtained from:	DragonflyBSD
2015-11-01 12:00:55 +00:00
..
big5.5
big5.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
btowc.3 btowc(3), isblank(3): Correct prototypes for _l variants. 2013-03-27 21:31:40 +00:00
btowc.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
c16rtomb_iconv.c Add libiconv based versions of *c16*() and *c32*(). 2013-06-03 17:17:56 +00:00
c16rtomb.c Add <uchar.h>. 2013-05-21 19:59:37 +00:00
c32rtomb_iconv.c Add libiconv based versions of *c16*() and *c32*(). 2013-06-03 17:17:56 +00:00
c32rtomb.c Add <uchar.h>. 2013-05-21 19:59:37 +00:00
collate.c collate: Fix expansion substitions (broken upstream too) 2015-10-23 23:24:03 +00:00
collate.h Fix typo 2015-08-09 00:21:59 +00:00
collcmp.c The collate functions within libc have been using version 1 and 1.2 of the 2015-08-07 23:41:26 +00:00
ctype_l.3 ctype_l(3): Note that not all these functions are specified by POSIX.1-2008. 2012-07-01 22:18:20 +00:00
ctype.3 Remove trailing whitespace per mdoc lint warning 2012-03-29 05:02:12 +00:00
ctype.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
cXXrtomb_iconv.h Remove the const qualifier from iconv(3) to comply with POSIX: 2015-04-15 09:09:20 +00:00
DESIGN.xlocale Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
digittoint.3 mdoc: improvements to SEE ALSO. 2014-12-27 08:31:52 +00:00
duplocale.3 Small changes to locale-related man pages. 2015-04-24 10:17:55 +00:00
euc.5
euc.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
fix_grouping.c
freelocale.3 Small changes to locale-related man pages. 2015-04-24 10:17:55 +00:00
gb2312.5
gb2312.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
gb18030.5
gb18030.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
gbk.5
gbk.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
isalnum.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
isalpha.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
isascii.3
isblank.3 btowc(3), isblank(3): Correct prototypes for _l variants. 2013-03-27 21:31:40 +00:00
iscntrl.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
isctype.c Commit log from Dragonfly: 2015-10-13 20:43:49 +00:00
isdigit.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
isgraph.3 Add more locale-specific functions to the relevant man pages and Makefile: 2012-07-30 20:56:19 +00:00
isideogram.3
islower.3 Remove trailing whitespace. 2012-07-30 21:02:44 +00:00
isphonogram.3
isprint.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
ispunct.3 Add more locale-specific functions to the relevant man pages and Makefile: 2012-07-30 20:56:19 +00:00
isrune.3
isspace.3 Add more locale-specific functions to the relevant man pages and Makefile: 2012-07-30 20:56:19 +00:00
isspecial.3
isupper.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
iswalnum_l.3 Start manpage with Dd macro and also remove a trailing whitespace 2012-07-26 14:46:19 +00:00
iswalnum.3
iswctype.c Commit log from Dragonfly: 2015-10-13 20:43:49 +00:00
isxdigit.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
ldpart.c libc: Use O_CLOEXEC for various internal file descriptors. 2012-09-29 11:54:34 +00:00
ldpart.h
lmessages.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
lmessages.h Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
lmonetary.c libc/locale: Remove a wrong comma. 2014-09-04 17:36:21 +00:00
lmonetary.h Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
lnumeric.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
lnumeric.h Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
localeconv.3 Split sentences at period boundaries. 2011-12-02 11:55:09 +00:00
localeconv.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
Makefile.inc Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
mblen.3
mblen.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mblocal.h Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
mbrlen.3
mbrlen.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mbrtoc16_iconv.c Add libiconv based versions of *c16*() and *c32*(). 2013-06-03 17:17:56 +00:00
mbrtoc16.c Add <uchar.h>. 2013-05-21 19:59:37 +00:00
mbrtoc32_iconv.c Add libiconv based versions of *c16*() and *c32*(). 2013-06-03 17:17:56 +00:00
mbrtoc32.c Add <uchar.h>. 2013-05-21 19:59:37 +00:00
mbrtocXX_iconv.h Remove the const qualifier from iconv(3) to comply with POSIX: 2015-04-15 09:09:20 +00:00
mbrtowc.3 Add <uchar.h>. 2013-05-21 19:59:37 +00:00
mbrtowc.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mbsinit.3
mbsinit.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mbsnrtowcs.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
mbsrtowcs.3
mbsrtowcs.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mbstowcs.3
mbstowcs.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mbtowc.3
mbtowc.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mskanji.5
mskanji.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
multibyte.3
newlocale.3 Small changes to locale-related man pages. 2015-04-24 10:17:55 +00:00
nextwctype.3
nextwctype.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
nl_langinfo.3 Add more locale-specific functions to the relevant man pages and Makefile: 2012-07-30 20:56:19 +00:00
nl_langinfo.c libc: Fix (and improve) nl_langinfo (CODESET) 2015-11-01 12:00:55 +00:00
nomacros.c Fix build of libc.so after r232620. This caused a duplicate definition 2012-03-06 21:56:30 +00:00
none.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
querylocale.3 Small changes to locale-related man pages. 2015-04-24 10:17:55 +00:00
rpmatch.3
rpmatch.c
rune.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
runefile.h
runetype.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
setlocale.3 mdoc: drop redundant .Pp and .LP calls 2010-10-08 12:40:16 +00:00
setlocale.c Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:50:18 +00:00
setlocale.h
setrunelocale.c libc: Fix (and improve) nl_langinfo (CODESET) 2015-11-01 12:00:55 +00:00
Symbol.map Mark __collate_load_tables_l as static 2015-08-09 10:24:24 +00:00
table.c Commit log from Dragonfly: 2015-10-13 20:43:49 +00:00
toascii.3
tolower.3
tolower.c Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:50:18 +00:00
toupper.3
toupper.c Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:50:18 +00:00
towlower.3
towupper.3
uselocale.3 Small changes to locale-related man pages. 2015-04-24 10:17:55 +00:00
utf8.5
utf8.c Merge from HEAD 2015-08-25 20:14:50 +00:00
wcrtomb.3 Add <uchar.h>. 2013-05-21 19:59:37 +00:00
wcrtomb.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcsftime.3
wcsftime.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcsnrtombs.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
wcsrtombs.3
wcsrtombs.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstod.3
wcstod.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstof.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstoimax.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstol.3
wcstol.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstold.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstoll.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstombs.3
wcstombs.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstoul.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstoull.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstoumax.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wctob.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wctomb.3
wctomb.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wctrans.3
wctrans.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wctype.3
wctype.c Commit log from Dragonfly: 2015-10-13 20:43:49 +00:00
wcwidth.3
wcwidth.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
xlocale_private.h Add <uchar.h>. 2013-05-21 19:59:37 +00:00
xlocale.3 mdoc: improvements to SEE ALSO. 2014-12-27 08:31:52 +00:00
xlocale.c Fix an issue where the locale and rune locale could become out of sync, 2014-04-02 11:10:46 +00:00