From: Rafael Garcia-Suarez Date: Mon, 14 Jan 2008 22:48:46 +0000 (+0000) Subject: When parsing LC_ALL or LANG to get the locale's encoding, ignore X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=643faf28065a2257c2544469a7acb20fa2580633;p=p5sagit%2Fp5-mst-13.2.git When parsing LC_ALL or LANG to get the locale's encoding, ignore whatever is after the @, since that's a modifier, not an encoding. p4raw-id: //depot/perl@32977 --- diff --git a/ext/Encode/encoding.pm b/ext/Encode/encoding.pm index 72a1c82..16139c1 100644 --- a/ext/Encode/encoding.pm +++ b/ext/Encode/encoding.pm @@ -1,6 +1,6 @@ # $Id: encoding.pm,v 2.6 2007/04/22 14:56:12 dankogai Exp $ package encoding; -our $VERSION = do { my @r = ( q$Revision: 2.6 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; +our $VERSION = '2.6_01'; use Encode; use strict; @@ -51,10 +51,10 @@ sub _get_locale_encoding { no warnings 'uninitialized'; if ( not $locale_encoding && in_locale() ) { - if ( $ENV{LC_ALL} =~ /^([^.]+)\.([^.]+)$/ ) { + if ( $ENV{LC_ALL} =~ /^([^.]+)\.([^.@]+)(@.*)?$/ ) { ( $country_language, $locale_encoding ) = ( $1, $2 ); } - elsif ( $ENV{LANG} =~ /^([^.]+)\.([^.]+)$/ ) { + elsif ( $ENV{LANG} =~ /^([^.]+)\.([^.@]+)(@.*)?$/ ) { ( $country_language, $locale_encoding ) = ( $1, $2 ); }