[libcatmandu-perl] 20/101: Fixing UTF processing on globs
Jonas Smedegaard
dr at jones.dk
Tue Feb 23 13:43:49 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository libcatmandu-perl.
commit 65a2ba98c93fdb8dec08897412b087a3b7ed82a1
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date: Fri Dec 11 11:59:54 2015 +0100
Fixing UTF processing on globs
---
Build.PL | 4 ++++
cpanfile | 2 ++
lib/Catmandu/Util.pm | 2 +-
t/Catmandu-Cmd-data.t | 2 +-
t/Catmandu-Cmd-export.t | 2 +-
t/Catmandu-Fix.t | 11 ++++++++---
t/myfixes.fix | 2 +-
7 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/Build.PL b/Build.PL
index fa727df..c96d651 100644
--- a/Build.PL
+++ b/Build.PL
@@ -64,7 +64,9 @@ my %module_build_args = (
"bin/catmandu"
],
"test_requires" => {
+ "Log::Any::Adapter::Log4perl" => 0,
"Log::Any::Test" => "1.03",
+ "Log::Log4perl" => 0,
"Test::Deep" => "0.112",
"Test::Exception" => "0.32",
"Test::LWP::UserAgent" => 0,
@@ -75,7 +77,9 @@ my %module_build_args = (
my %fallback_build_requires = (
+ "Log::Any::Adapter::Log4perl" => 0,
"Log::Any::Test" => "1.03",
+ "Log::Log4perl" => 0,
"Module::Build" => "0.28",
"Test::Deep" => "0.112",
"Test::Exception" => "0.32",
diff --git a/cpanfile b/cpanfile
index f32c7d9..21c5ccc 100644
--- a/cpanfile
+++ b/cpanfile
@@ -7,6 +7,8 @@ on 'test', sub {
requires 'Test::Pod', 0;
requires 'Log::Any::Test', '1.03';
requires 'Test::LWP::UserAgent' , 0;
+ requires 'Log::Log4perl' , 0;
+ requires 'Log::Any::Adapter::Log4perl', 0;
};
requires 'App::Cmd', '0.33';
diff --git a/lib/Catmandu/Util.pm b/lib/Catmandu/Util.pm
index 990b6f7..75cd1a0 100644
--- a/lib/Catmandu/Util.pm
+++ b/lib/Catmandu/Util.pm
@@ -131,7 +131,7 @@ sub read_file {
sub read_io {
my ($io) = @_;
- $io->binmode("encoding(UTF-8)");
+ $io->binmode("encoding(UTF-8)") if ($io->can('binmode'));
my @lines = ();
while (<$io>) {
push @lines, $_;
diff --git a/t/Catmandu-Cmd-data.t b/t/Catmandu-Cmd-data.t
index 8f7305b..2d076e7 100644
--- a/t/Catmandu-Cmd-data.t
+++ b/t/Catmandu-Cmd-data.t
@@ -42,7 +42,7 @@ use Catmandu::CLI;
ok $perl, 'got JSON';
is $perl->{value} , 'Sol' , 'got data';
- is $perl->{utf8_name} , 'काठमाडौं' , 'got utf8 data';
+ is $perl->{utf8_name} , 'ვეპხის ტყაოსანი შოთა რუსთაველი' , 'got utf8 data';
is $result->error, undef, 'threw no exceptions' ;
}
diff --git a/t/Catmandu-Cmd-export.t b/t/Catmandu-Cmd-export.t
index 6e37a59..add6780 100644
--- a/t/Catmandu-Cmd-export.t
+++ b/t/Catmandu-Cmd-export.t
@@ -27,7 +27,7 @@ my $perl = decode_json($lines[0]);
ok $perl, 'got JSON';
is $perl->{value} , 'Sol' , 'got data';
-is $perl->{utf8_name} , 'काठमाडौं' , 'got utf8 data';
+is $perl->{utf8_name} , 'ვეპხის ტყაოსანი შოთა რუსთაველი' , 'got utf8 data';
is $result->error, undef, 'threw no exceptions' ;
## Next test can fail on buggy Perl installations
diff --git a/t/Catmandu-Fix.t b/t/Catmandu-Fix.t
index 5247a08..0df39e4 100644
--- a/t/Catmandu-Fix.t
+++ b/t/Catmandu-Fix.t
@@ -63,9 +63,14 @@ throws_ok {
$fixer->fix({});
} 'Catmandu::FixError';
-
$fixer = Catmandu::Fix->new(fixes => ['t/myfixes.fix']);
ok $fixer;
-is_deeply $fixer->fix({}), {utf8_name => 'काठमाडौं'} , 'fixing utf8';
+is_deeply $fixer->fix({}), {utf8_name => 'ვეპხის ტყაოსანი შოთა რუსთაველი'} , 'fixing utf8';
+
+open(FH,'<:encoding(UTF-8)','t/myfixes.fix');
+$fixer = Catmandu::Fix->new(fixes => [\*FH]);
+ok $fixer;
+is_deeply $fixer->fix({}), {utf8_name => 'ვეპხის ტყაოსანი შოთა რუსთაველი'} , 'fixing utf8';
+close(FH);
-done_testing 26;
\ No newline at end of file
+done_testing 28;
\ No newline at end of file
diff --git a/t/myfixes.fix b/t/myfixes.fix
index 8b83ac2..e4d314c 100644
--- a/t/myfixes.fix
+++ b/t/myfixes.fix
@@ -1,2 +1,2 @@
# For use in t/Catmandu-Fix.t
-add_field(utf8_name,'काठमाडौं')
\ No newline at end of file
+add_field(utf8_name,'ვეპხის ტყაოსანი შოთა რუსთაველი')
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcatmandu-perl.git
More information about the Pkg-perl-cvs-commits
mailing list