[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-recutils] Locale issues [was: Comparison operator on reals fail
From: |
Jose E. Marchesi |
Subject: |
Re: [bug-recutils] Locale issues [was: Comparison operator on reals fails] |
Date: |
Sat, 11 Aug 2012 01:46:17 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
Hi John.
Ahh! I know why! I had my locale set to de_DE were . is not the
decimal separator. It works when I set LC_ALL=C
However this raises a number of questions?
* Why didn't recfix at least warn me that the fields declared as real
were not valid in the current locale?
Because the checking is performed using a fixed regexp wich uses the dot
to separate mantissas from the decimal part.
* There should be something about this in the user manual.
We must temporarily change the locale to LC_ALL before using strtod, in
order to make it using a fixed syntax for real numbers, i.e. the dot
separates mantissa from decimal part.
We are already doing that when parsing dates for example:
setlocale (LC_TIME, "C"); /* We want english dates that can be
parsed with parse_datetime */
strftime (outstr, sizeof(outstr), "%a, %d %b %Y %T %z", tmp);
setlocale (LC_TIME, ""); /* And restore the locale from the
environment. */
* How does locale affect other things. For example:
- does LC_COLLATE change the sort order?
Well, is LC_COLLATE affecting strcmp?
- the documentation says that "A field name is a sequence of
alphanumeric characters"
does that mean it consults the LC_CTYPE catagory to decide what it
"alphanumeric"? If
so, this could mean that something which is a valid field name in
one locale is invalid
in another.
Hmm, good question :)
--
Jose E. Marchesi http://www.jemarch.net
GNU Project http://www.gnu.org