bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: GNU Awk 3.1.0 problem with float numbers with non-US locale


From: Stepan Kasal
Subject: Re: GNU Awk 3.1.0 problem with float numbers with non-US locale
Date: Wed, 10 Jul 2002 11:48:25 +0000 (UTC)
User-agent: slrn/0.9.6.2 (Linux)

Hallo,

On Wed, 10 Jul 2002 13:11:37 +0300, Jouko Loikkanen wrote:
> Is that known problem or a bug? It works OK with older awk but not
> the newest if locale (Start->Setting->Control Panel->Regional Options->
> Location) is e.g. finnish?

> Base number to sum XX (float) is: 10,000000 (float)

this means that awk uses numeric locale settings.

My copy of gawk-3.1.0/main.c contains the following lines:

        setlocale(LC_CTYPE, "");
        setlocale(LC_COLLATE, "");
        /* setlocale (LC_ALL, ""); */

if the last line were not commented out, it would cause the error you
describe.  You may not call setlocale(LC_ALL,"") nor
setlocale(LC_NUMERIC, "") in the source of gawk.

So, according to my information, it was fixed in 3.1.0, but it is surely
fixed in 3.1.1, in case you have access to it.

I don't know which Windows distribution of gawk you use; if it's cygwin,
you may easily compile gawk-3.1.1 yourself.

In case getting 3.1.1 is not an option, you may try to set the environment
variable LC_NUMERIC=C

If you use cygwin, you can write a simple shell wrapper:

#! /bin/bash
LC_NUMERIC=C gawk3 "$*"

or

#! /bin/bash
export LC_NUMERIC=C
gawk3 "$*"

If you use just windows port of gawk, I'm afraid writing similar BAT file
is not an option, since the shells clobbers the parameters.
But you can try setting LC_NUMERIC=C globally.

HTH,
        Stepan Kasal





reply via email to

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