chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] date, string formatting and locale


From: Thomas Chust
Subject: Re: [Chicken-users] date, string formatting and locale
Date: Wed, 3 Nov 2010 17:20:08 +0100

2010/11/3 Hugo Arregui <address@hidden>:
> [...]
> 1) Using posix:
>
> (use posix)
> (time->string (string->time "2" "%d"))
> "Tue Jan  2 00:00:00 1900"
>
> but, my current locale es:
>
> (use locale)
> (current-locale)
> "es_AR.utf8"
> [...]

Hello,

the POSIX functions use the C standard library's locale which is entirely
independent from that of the locale egg.

In fact, if you set the C library's locale to anything else than "C", all hell
breaks lose inside CHICKEN: For example the reader will no longer recognize
floating point numbers in the standard Scheme format. If you are lucky numbers
in the C library locale's format will be recognized, but if the locale happens
to change the decimal point to something else than #\. it is very likely that no
floating point numbers will be recognized at all by the reader.

If you change the C library's locale at all from inside a Scheme program, I
would advise to keep this change strictly local to the application of procedures
like time->string and always ensure that the locale is reset to "C" upon exit
from the relevant dynamic scopes.

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.



reply via email to

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