Web lists-archives.com

Re: Using g_utf8_collate() with gtk_disable_setlocale()

On 09.03.2017 at 19:20 Emmanuele Bassi wrote:

> You should be using `g_ascii_strtod()` if you need a
> locale-independent version of `strtod()`, instead of disabling the
> locale.

> In general, disabling the locale is only meant for specific, limited
> cases, like platforms with broken locales, or debugging, not as a "get
> out of jail for free" card.

Easier said than done. The application in question is a rather large
one which can also be extended via plugins. Plugins expect the locale
to be "C". I don't see how to workaround that without breaking plugins.

Also, what about functions like sscanf()? I don't see any g_ascii_sscanf()
replacement. On a German locale sscanf() will expect a comma instead of a
point as a decimal separator. 

IMHO it would have been a much cleaner solution if glib locales were
completely separated from C's standard locales which many people consider
seriously broken.

Heck, even Wikipedia says "Most large-scale software forces the locale to "C"
(or another fixed value) to work around these problems."


Best regards,
 Andreas Falkenhahn                            mailto:andreas@xxxxxxxxxxxxxx

gtk-list mailing list