Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-09-29 23:12:28 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-09-29 23:12:28 +0400
commit50e4e69c42d6b267997b62a261e1cf7d5b342d8c (patch)
tree3824aa0c4c55a6f6bf6ed79382bcf5aac2af271f /newlib/libc/locale/locale.c
parent99dbad651cbc592c334deab254f59cb22f42ace9 (diff)
* libc/locale/locale.c (loadlocale): Allow "C." same as "C-" as locale
prefix. Add some words to documentation.
Diffstat (limited to 'newlib/libc/locale/locale.c')
-rw-r--r--newlib/libc/locale/locale.c15
1 files changed, 13 insertions, 2 deletions
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">>, <<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;