diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-01-14 22:48:46 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-01-14 22:48:46 +0000 |
commit | 643faf28065a2257c2544469a7acb20fa2580633 (patch) | |
tree | a36e88ab9d5fe0b65ebd1135ccfebb51ce5af5a3 /ext/Encode | |
parent | 9064044581ce3beb1332f29068a99ae32d4e7992 (diff) | |
download | perl-643faf28065a2257c2544469a7acb20fa2580633.tar.gz |
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
Diffstat (limited to 'ext/Encode')
-rw-r--r-- | ext/Encode/encoding.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/Encode/encoding.pm b/ext/Encode/encoding.pm index 72a1c82fc9..16139c1518 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 ); } |