I can still reproduce this error with the latest CPAN version - the key
appears to be having use open ":encoding(utf8)" enabled before loading
Locale::SubCountry:
[dave@gen:~]$ perl -w -e 'use open ":encoding(utf8)"; use
Locale::SubCountry; my $lc = Locale::SubCountry->new("GB"); print
$lc->country;'
utf8 "\xE4" does not map to Unicode at
/opt/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Locale/SubCountry.pm line
259.
utf8 "\xE4" does not map to Unicode at
/opt/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Locale/SubCountry.pm line
259.
utf8 "\xE4" does not map to Unicode at
/opt/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Locale/SubCountry.pm line
259.
United Kingdom
[dave@gen:~]$ cpanm Locale::SubCountry
Locale::SubCountry is up to date. (1.61)
Of course, in response to "it throws warnings when I do $this", "don't
do that, then" is a reasonable response, but I thought I'd re-open this
ticket with a one-liner example of how to tickle this warning.
It's certainly irritating to us in our codebase at work.
I think the line number reported by the warning is wrong, though - line
259 is an empty line for me.
The actual source of the problem is the two AZERBAIJAN examples - the
following diff silences the warning for us:
-- SubCountry.pm 2013-02-26 21:27:14.000000000 +0000
+++
/opt/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Locale/SubCountry.pm 2013-02-26
21:31:58.000000000 +0000
@@ -277,8 +277,6 @@
because the name represents two different types of sub country, such as a
province and a geographical unit. Examples are:
- AZERBAIJAN : L�nk�ran; LA (the City), LAN (the Rayon)
- AZERBAIJAN : S�ki; SA,SAK
AZERBAIJAN : Susa; SS,SUS
AZERBAIJAN : Yevlax; YE,YEV
INDONESIA : Kalimantan Timur; KI,KT
Note that whatever characters they're supposed to be, they don't display
properly for me in my editor, here in this ticket, or on MetaCPAN.
Having worked out what characters they're supposed to be ("LATIN SMALL
LETTER A WITH DIAERESIS"), I copied and pasted the names from Wikipedia
containing the right characters, and all was well:
[dave@gen:~]$ diff -u SubCountry.pm
/opt/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Locale/SubCountry.pm
--- SubCountry.pm 2013-02-26 21:27:14.000000000 +0000
+++
/opt/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Locale/SubCountry.pm 2013-02-26
21:39:21.000000000 +0000
@@ -277,8 +277,8 @@
because the name represents two different types of sub country, such as a
province and a geographical unit. Examples are:
- AZERBAIJAN : L�nk�ran; LA (the City), LAN (the Rayon)
- AZERBAIJAN : S�ki; SA,SAK
+ AZERBAIJAN : Länkäran; LA (the City), LAN (the Rayon)
+ AZERBAIJAN : Shäki; SA,SAK
AZERBAIJAN : Susa; SS,SUS
AZERBAIJAN : Yevlax; YE,YEV
INDONESIA : Kalimantan Timur; KI,KT
So, this looks to be the fix. Would you be willing to incorporate this
change in the next version?