Patch: FYI: PR 5031
Tom Tromey
tromey@redhat.com
Tue Jan 8 13:58:00 GMT 2002
I'm checking this in.
This fixes PR 5031.
setlocale(LC_ALL,"") can return a long form of the locale in some
situations. This confuses the code that sets user.region. My fix is
to simply look at LC_MESSAGES only. I think we have to pick a single
part of the locale since Java and POSIX locales work differently.
LC_MESSAGES seemed like the most reasonable choice to me.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
For PR libgcj/5031:
* java/lang/natSystem.cc (init_properties): Use LC_MESSAGES to
choose default locale.
Index: java/lang/natSystem.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natSystem.cc,v
retrieving revision 1.42
diff -u -r1.42 natSystem.cc
--- java/lang/natSystem.cc 2002/01/06 21:38:15 1.42
+++ java/lang/natSystem.cc 2002/01/08 21:45:08
@@ -415,7 +415,12 @@
// Set user locale properties based on setlocale()
#ifdef HAVE_SETLOCALE
- char *locale = setlocale (LC_ALL, "");
+ // We let the user choose the locale. However, since Java differs
+ // from POSIX, we arbitrarily pick LC_MESSAGES as determining the
+ // Java locale. We can't use LC_ALL because it might return a full
+ // list of all the settings.
+ setlocale (LC_ALL, "");
+ char *locale = setlocale (LC_MESSAGES, "");
if (locale && strlen (locale) >= 2)
{
char buf[3];
More information about the Java-patches
mailing list