bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Using ENVIRON["LANG"] = "C" instead of --characters-as-by


From: Eli Zaretskii
Subject: Re: [bug-gawk] Using ENVIRON["LANG"] = "C" instead of --characters-as-bytes
Date: Thu, 12 Mar 2015 21:11:37 +0200

> Date: Thu, 12 Mar 2015 19:14:47 +0100
> From: Hermann Peifer <address@hidden>
> 
> I thought that in gawk/master, I could use ENVIRON["LANG"] = "C" instead 
> of --characters-as-bytes, in analogy to changing the time zone via 
> ENVIRON["TZ"] = "UTC". I do however always end up with the lint warning: 
> Invalid multibyte data detected. There may be a mismatch between your 
> data and your locale.
> 
> Is this a feature ?
> 
> Hermann
> 
> # Some code snippet which doesn't work as epxected
> BEGIN {
>       # Try to simulate --characters-as-bytes
>       ENVIRON["LC_ALL"] = "C"
>       ENVIRON["LANG"] = "C"
> }

AFAIR, you need to call 'setlocale' after setting these in the
environment, for it to switch to another locale.  Unless, that is,
Gawk does that for you when you set these members in ENVIRON[] (which
it doesn't, AFAICS).

And btw, the assumption that 'setlocale' looks at these environment
variables is non-portable outside of the Posix world.



reply via email to

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