[libcatmandu-perl] 54/101: fix encoding
Jonas Smedegaard
dr at jones.dk
Tue Feb 23 13:43:54 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 604a743c57955bbf1877e02bee124d07e80276f1
Author: Nicolas Steenlant <nicolas.steenlant at ugent.be>
Date: Tue Jan 19 14:21:30 2016 +0100
fix encoding
---
Build.PL | 1 +
lib/Catmandu/Cmd/delete.pm | 2 +-
lib/Catmandu/Fix/uri_decode.pm | 5 ++++-
lib/Catmandu/Fix/uri_encode.pm | 2 ++
t/Catmandu-Fix-uri_decode.t | 3 ++-
t/Catmandu-Fix-uri_encode.t | 2 +-
6 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/Build.PL b/Build.PL
index 54dec0f..aae0a0a 100644
--- a/Build.PL
+++ b/Build.PL
@@ -54,6 +54,7 @@ my %module_build_args = (
"Time::Piece" => 0,
"Try::Tiny::ByClass" => "0.01",
"URI" => 0,
+ "URI::Escape" => 0,
"URI::Template" => 0,
"Unicode::Normalize" => 0,
"YAML::XS" => "0.41",
diff --git a/lib/Catmandu/Cmd/delete.pm b/lib/Catmandu/Cmd/delete.pm
index 9cf4474..b9b682e 100644
--- a/lib/Catmandu/Cmd/delete.pm
+++ b/lib/Catmandu/Cmd/delete.pm
@@ -6,7 +6,7 @@ our $VERSION = '0.9505';
use parent 'Catmandu::Cmd';
use Catmandu;
-use Catmandu::Util qw(delete_by_query);
+use Catmandu::Util qw(check_able);
use namespace::clean;
sub command_opt_spec {
diff --git a/lib/Catmandu/Fix/uri_decode.pm b/lib/Catmandu/Fix/uri_decode.pm
index 5b5470a..3ccf47c 100644
--- a/lib/Catmandu/Fix/uri_decode.pm
+++ b/lib/Catmandu/Fix/uri_decode.pm
@@ -2,6 +2,7 @@ package Catmandu::Fix::uri_decode;
use Catmandu::Sane;
use Moo;
+use Encode ();
use URI::Escape ();
use namespace::clean;
use Catmandu::Fix::Has;
@@ -12,7 +13,7 @@ with 'Catmandu::Fix::SimpleGetValue';
sub emit_value {
my ($self, $var) = @_;
- "${var} = URI::Escape::uri_unescape(${var});";
+ "${var} = Encode::decode_utf8(URI::Escape::uri_unescape(${var}));";
}
1;
@@ -21,6 +22,8 @@ __END__
=pod
+=encoding utf8
+
=head1 NAME
Catmandu::Fix::uri_decode - percent decode a URI
diff --git a/lib/Catmandu/Fix/uri_encode.pm b/lib/Catmandu/Fix/uri_encode.pm
index 88ddb70..65cf9d6 100644
--- a/lib/Catmandu/Fix/uri_encode.pm
+++ b/lib/Catmandu/Fix/uri_encode.pm
@@ -21,6 +21,8 @@ __END__
=pod
+=encoding utf8
+
=head1 NAME
Catmandu::Fix::uri_encode - percent encode a URI
diff --git a/t/Catmandu-Fix-uri_decode.t b/t/Catmandu-Fix-uri_decode.t
index 97472ab..c279ad1 100644
--- a/t/Catmandu-Fix-uri_decode.t
+++ b/t/Catmandu-Fix-uri_decode.t
@@ -1,4 +1,5 @@
#!/usr/bin/env perl
+
use utf8;
use strict;
use warnings;
@@ -17,7 +18,7 @@ is_deeply
"unescape utf8 string from French";
is_deeply
- $pkg->new('name')->fix({name => '%E1%BD%81+%CF%84%E1%BF%B6%CE%BD+%CE%A0%CE%AD%CF%81%CF%83%CF%89%CE%BD+%CE%B2%CE%B1%CF%83%CE%B9%CE%BB%CE%B5%CF%8D%CF%82'}),
+ $pkg->new('name')->fix({name => '%E1%BD%81%20%CF%84%E1%BF%B6%CE%BD%20%CE%A0%CE%AD%CF%81%CF%83%CF%89%CE%BD%20%CE%B2%CE%B1%CF%83%CE%B9%CE%BB%CE%B5%CF%8D%CF%82'}),
{name => "ὁ τῶν Πέρσων βασιλεύς"},
"unescape utf8 string from Greek";
diff --git a/t/Catmandu-Fix-uri_encode.t b/t/Catmandu-Fix-uri_encode.t
index 899f649..73b8d1e 100644
--- a/t/Catmandu-Fix-uri_encode.t
+++ b/t/Catmandu-Fix-uri_encode.t
@@ -18,7 +18,7 @@ is_deeply
is_deeply
$pkg->new('name')->fix({name => 'ὁ τῶν Πέρσων βασιλεύς'}),
- {name => "%E1%BD%81+%CF%84%E1%BF%B6%CE%BD+%CE%A0%CE%AD%CF%81%CF%83%CF%89%CE%BD+%CE%B2%CE%B1%CF%83%CE%B9%CE%BB%CE%B5%CF%8D%CF%82"},
+ {name => "%E1%BD%81%20%CF%84%E1%BF%B6%CE%BD%20%CE%A0%CE%AD%CF%81%CF%83%CF%89%CE%BD%20%CE%B2%CE%B1%CF%83%CE%B9%CE%BB%CE%B5%CF%8D%CF%82"},
"escape utf8 string from Greek";
done_testing;
--
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