Is -C useless?

Dagfinn Ilmari Mannsåker ilmari at ilmari.org
Fri Sep 12 01:10:27 BST 2008


Paul LeoNerd Evans <leonerd at leonerd.org.uk> writes:

> On Fri, 12 Sep 2008 00:48:06 +0100
> Paul LeoNerd Evans <leonerd at leonerd.org.uk> wrote:
>
>>   binmode STDOUT, ":utf8" if grep m/utf-?8/i, @ENV{qw(LANG LC_MESSAGES LC_ALL)};
>> 
>> And even then I'm not sure it's right.
>
> Actually it's still not... We have to take the first defined one, not try
> our best to find one:
>
>   binmode STDOUT, ":utf8" if ( $ENV{LC_ALL} || $ENV{LC_MESSAGES} || $ENV{LANG} ) =~ m/utf-?8/i
>
> which -technically- still breaks because we could have  LC_ALL=0  in our
> environment, but I think it's close enough.

Or you could just use I18N::Langinfo.

-- 
ilmari
"A disappointingly low fraction of the human race is,
 at any given time, on fire." - Stig Sandbeck Mathisen


More information about the london.pm mailing list