Skip Menu |

This queue is for tickets about the Locale-SubCountry CPAN distribution.

Report information
The Basics
Id: 73829
Status: resolved
Priority: 0/
Queue: Locale-SubCountry

People
Owner: Nobody in particular
Requestors: rtcpan.carlim [...] inboxclean.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.47
Fixed in: (no value)



Subject: missing 'use utf8' on data source code
The data in lib/Locale/SubCountry/Data.pm is properly encoded as UTF-8 but is missing the 'use utf8' declaration. This means that perl treats the data as bytes and not Unicode Chars. One example of the effects can be seen by doing: carlos@multi:~/dev/Locale-SubCountry-1.47$ cat a.t use Test::More 'no_plan'; use Locale::SubCountry; my $BR = Locale::SubCountry->new('BR'); is length $BR->full_name('PR'), 6, "Proper encoding"; is length $BR->full_name('MA'), 8, "Proper encoding"; carlos@multi:~/dev/Locale-SubCountry-1.47$ perl -Ilib a.t not ok 1 - Proper encoding # Failed test 'Proper encoding' # at a.t line 5. # got: '7' # expected: '6' not ok 2 - Proper encoding # Failed test 'Proper encoding' # at a.t line 6. # got: '9' # expected: '8' 1..2 # Looks like you failed 2 tests of 2. I've fixed the issue and published it on my github account: https://github.com/carloslima/p5-locale- subcountry/commit/650d30a9794789ad261eb174406a7046a7160efe I'm also attaching the patch in case it's more convenient. Thanks a lot for creating and maintaining this module :-) ~Carlos
Subject: 0001-Properly-declare-we-have-utf8-data-on-the-source-fil.patch
From 650d30a9794789ad261eb174406a7046a7160efe Mon Sep 17 00:00:00 2001 From: Carlos Lima <carlos@multi> Date: Mon, 9 Jan 2012 01:45:33 +0800 Subject: [PATCH] Properly declare we have utf8 data on the source file --- lib/Locale/SubCountry/Data.pm | 3 ++- t/main.t | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Locale/SubCountry/Data.pm b/lib/Locale/SubCountry/Data.pm index 2f0a6a6..1265c9c 100644 --- a/lib/Locale/SubCountry/Data.pm +++ b/lib/Locale/SubCountry/Data.pm @@ -30,6 +30,7 @@ it under the same terms as Perl itself. use strict; use warnings; +use utf8; package Locale::SubCountry::Data; our $VERSION = '1.47'; @@ -22566,4 +22567,4 @@ q{ }; #------------------------------------------------------------------------------- -1; \ No newline at end of file +1; diff --git a/t/main.t b/t/main.t index 22dfbcc..a09136b 100644 --- a/t/main.t +++ b/t/main.t @@ -6,7 +6,7 @@ use strict; use warnings; -use Test::Simple tests => 18; +use Test::Simple tests => 20; use Locale::SubCountry; my $australia = new Locale::SubCountry('Australia'); @@ -60,7 +60,6 @@ ok(@all_country_names, "all_full_names method returns data for world object"); my $UK = new Locale::SubCountry('GB'); ok($UK->regional_division('DGY') eq 'SCT', "Initialise new method with a 2 letter country code"); - - - - +my $BR = Locale::SubCountry->new('BR'); +ok length $BR->full_name('PR') == 6, "Proper encoding"; +ok length $BR->full_name('MA') == 8, "Proper encoding"; -- 1.7.4.1
Fixed in version 1.50