[Top][All Lists]

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

Re: locale-dependent number parsing?

From: Linas Vepstas
Subject: Re: locale-dependent number parsing?
Date: Mon, 5 Apr 2010 12:56:36 -0500

On 5 April 2010 12:19, Mike Gran <address@hidden> wrote:
>From: Linas Vepstas <address@hidden>
>I've found the following bug/feature with guile-1.8.7 and would like to solicit for comments.
>Is this a guile bug? What's the proper work-around?
>I've got a C program that does a setlocale (LC_ALL, "");   printf ("%f", 0.2000);
>In the de_DE.utf8 locale, the result of the print is 0,2000  using a comma, since
>the comma is the "decimal separator" in most European locales. This numeric
>string is then passed to scm_eval_string() which pukes on it, because it does not
>recognize 0,2  as a valid number.    This can be confirmed at the guile command
>line interpreter, which pukes on guile> (+ 0,2 0,2)  but works fine on (+ 0.2 0.2)
>even in the de_DE locale.
>Is this really the expected behaviour? Is there a suggested work-around?

I know that for the pre-2.0 Guile, I tried to punt that problem upstream to
libunistring, but, it is not likely to be implemented in libunistring.

But, I never got around to working on it, myself.

Yeah, maybe I should say "never mind" at this point, since I now realize that
my suggestion would make scheme source code  depend on locale, which
would break source code as it moves across national boundaries... Silly me.
Moral of the story: mixing printf with guile is a bad idea.


reply via email to

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