diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 5aae7a0d9..387770118 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,4 +1,9 @@ -2009-09-27 Corinna Vinschen +2009-09-29 Corinna Vinschen + + * libc/locale/locale.c (loadlocale): Allow "C." same as "C-" as locale + prefix. Add some words to documentation. + +2009-09-29 Corinna Vinschen * libc/stdlib/sb_charsets.c: Throughout, translate undefined characters to their corresponding Windows Unicode value. diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 584e5d8f4..25b1a00d5 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -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">>, <>, <>, <<"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;