Paul LeoNerd Evans <[EMAIL PROTECTED]> writes:
> On Fri, 12 Sep 2008 00:48:06 +0100
> Paul LeoNerd Evans <[EMAIL PROTECTED]> 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