bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12392: emacs-gtk misinterprets floating-point numbers under certain


From: Holger Arnold
Subject: bug#12392: emacs-gtk misinterprets floating-point numbers under certain locales on openSUSE 12.2
Date: Sun, 23 Sep 2012 21:58:07 +0200

2012/9/23 Achim Gratz <Stromeko@nexgo.de>:
> Jan Djärv writes:
>> BTW, does doing setlocale LC_NUMERIC before gtk_init make things work?
>
> Not from within emacs, only if it is set as an environment variable.

Yes, that's what I meant.  Sorry Jan, I didn't want to confuse you.
Calling fixup_locale() before gtk_init() won't help.

> The locale is reset again to the environment when gstreamer is
> initialized, which is likely a bug in gstreamer.  The main window is
> already mapped at that time and the command loop is running.

I am going to file a gstreamer bug for this.  But since the
setlocale() call has been in gstreamer since 2004, it's probably not
going to change soon.

> The proper fix is likely to not bother with fixup_locale at all in its
> current form, but either implement the lisp reader without
> locale-dependent functions or getting a locale object on entry, change
> the locale, do whatever it needs to do under changed locale and then
> restore the locale.  This is what libraries are often doing for parsing
> configuration files, anyway.

No, only the first approach will work.  As it is currently
implemented, Emacs requires the numeric locale set to "C" whenever it
reads or writes lisp objects (which means: all the time), and changing
the locale before and after each such operation conflicts with
components that expect the "user" locale (such as GTK or GStreamer).
Besides, these components may start their own threads, which means
that setting the locale after these components have been initialized
introduces races.

If Emacs is to be a localized program, the Lisp parsers and writers
have to be made locale-independent; there is no way to avoid this.
fixup_locale() must go.

> There are also some hints that glib expects / recommends to call
> setlocale, textdomain, bind_textdomain and bind_textdomain_codeset early
> in main on order to properly initialize it.

Yes, and the only call to setlocale() should be setlocale(LC_ALL, "")
very early, before the user interface is initialized (that's why
gtk_init() does exactly this).

        Holger





reply via email to

[Prev in Thread] Current Thread [Next in Thread]