* libc/locale/locale.c (loadlocale): Allow "C." same as "C-" as locale

prefix.  Add some words to documentation.
This commit is contained in:
Corinna Vinschen 2009-09-29 19:12:28 +00:00
parent 99dbad651c
commit 50e4e69c42
2 changed files with 19 additions and 3 deletions

View File

@ -1,4 +1,9 @@
2009-09-27 Corinna Vinschen <corinna@vinschen.de>
2009-09-29 Corinna Vinschen <corinna@vinschen.de>
* libc/locale/locale.c (loadlocale): Allow "C." same as "C-" as locale
prefix. Add some words to documentation.
2009-09-29 Corinna Vinschen <corinna@vinschen.de>
* libc/stdlib/sb_charsets.c: Throughout, translate undefined
characters to their corresponding Windows Unicode value.

View File

@ -61,6 +61,11 @@ backward compatibility with older implementations using newlib:
xxx in [437, 720, 737, 775, 850, 852, 855, 857, 858, 862, 866, 874, 1125,
1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258].
Instead of <<"C-">>, you can specify also <<"C.">>. Both variations allow
to specify language neutral locales while using other charsets than ASCII,
for instance <<"C.UTF-8">>, which keeps all settings as in the C locale,
but uses the UTF-8 charset.
Even when using POSIX locale strings, the only charsets allowed are
<<"UTF-8">>, <<"JIS">>, <<"EUCJP">>, <<"SJIS">>, <<KOI8-R>>, <<KOI8-U>>,
<<"ISO-8859-x">> with 1 <= x <= 15, or <<"CPxxx">> with xxx in
@ -438,8 +443,14 @@ loadlocale(struct _reent *p, int category)
#else
strcpy (charset, "ASCII");
#endif
else if (locale[0] == 'C' && locale[1] == '-') /* Old newlib style */
strcpy (charset, locale + 2);
else if (locale[0] == 'C'
&& (locale[1] == '-' /* Old newlib style */
|| locale[1] == '.')) /* Extension for the C locale to allow
specifying different charsets while
sticking to the C locale in terms
of sort order, etc. Proposed in
the Debian project. */
strcpy (charset, locale + 2);
else /* POSIX style */
{
char *c = locale;