[kaffe] Toolkit.getDefaultToolkit() calls setlocale() which breaks non-C locales

Noa Resare noa at resare.com
Mon Sep 20 23:16:16 PDT 2004

It seems like a lot of kaffe code assumes that the locale is not set to
a value that format for example decimal number differently than the
standard C locale.

However, when you instantiate the the gtk awt toolkit for example by
calling java.awt.Toolkit.getDefaultToolkit() and have the classpath-gtk-
awt configured it calls setlocale(LC_ALL, "") (I think from gtk_init()).
If the invoking user's locale is set to for example sv_SE calling
getDefaultToolkit() with current cvs kaffe breaks for example formatting
of decimal numbers.

The attached patch explicitly resets the locale to "C" after gtk_init()
which fixes a boatload of mauve failures when run in sv_SE locale. 

This patch exhibits no regressions on my system[1], but it is worth
noting that jamvm with classpath-0.11 formats decimal numbers correctly
without this patch for reasons unclear to me.

If no one has a smarter solution on the top of their head I would like
to suggest applying this patch.

[1] i386, gcc-3.4.1-2, glibc-2.3.3-36, kernel-2.6.7-1.478


And the lions ate the christians and the christians burned the witches,
and even I am out of explanations -- Ola Salo
gpg fingerprint: F3C4 AC90 B885 FE15 344B  4D05 220B 7662 A190 6F09
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kaffe-setlocale.patch
Type: text/x-patch
Size: 944 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20040921/f55a6e91/attachment-0002.bin 

More information about the kaffe mailing list