[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Command line variable assignment problems with localized floats
From: |
Jürgen Kahrs |
Subject: |
Re: Command line variable assignment problems with localized floats |
Date: |
Mon, 25 Dec 2006 20:36:16 +0100 |
User-agent: |
Thunderbird 1.5.0.8 (X11/20060911) |
Heike C. Zimmerer wrote:
> $ echo | LC_NUMERIC=de_DE.utf8 awk "$awktest" a=1.23 b=4,56
> a: "1.23"->1,000000, b: "4,56"->4,000000
Confirmed, I can reproduce all your results.
> Neither "." (correct) nor the now current deciaml point (",") are
> recognized. (Btw, changing the last printf argument from `b´ into
> `b ""´ (concatenation with the empty string) yields the correct result,
> which seems to indicate to me that the error happens very early during the
> interpretation of the command line argument).
Good guess. The file main.c of GNU Awk 3.1.5 contains
the following comment on the issue:
/*
* Force the issue here. According to POSIX 2001, decimal
* point is used for parsing source code and for command-line
* assignments and the locale value for processing input,
* number to string conversion, and printing output.
*/
setlocale(LC_NUMERIC, "C");
This should explain your results. I have not checked
against the actual text of the POSIX documentation
in detail. I would leave it to Arnold Robbins or
Paul Eggert to decide on this one.