escaped URIs require UTF-8 encoding
Change-Id: Id7475e3f5e6bfe3e6b13a225b2d251db1a70c8e1
diff --git a/lib/KorAP/XML/Meta/Base.pm b/lib/KorAP/XML/Meta/Base.pm
index b00d894..8f6900b 100644
--- a/lib/KorAP/XML/Meta/Base.pm
+++ b/lib/KorAP/XML/Meta/Base.pm
@@ -1,6 +1,6 @@
package KorAP::XML::Meta::Base;
# use Mojo::Log;
-use Mojo::Util 'url_escape';
+use Mojo::Util qw!encode url_escape!;
use Log::Any qw($log);
use strict;
use warnings;
@@ -185,7 +185,7 @@
my $link = 'data:application/x.korap-link;';
foreach (sort CORE::keys %attributes) {
- $link .= url_escape($_) . '=' . url_escape($attributes{$_}) . ';';
+ $link .= url_escape(encode('UTF-8', $_)) . '=' . url_escape(encode('UTF-8', $attributes{$_})) . ';';
};
chop $link;
diff --git a/t/real/gingko.t b/t/real/gingko.t
index 65f10bd..6895c19 100644
--- a/t/real/gingko.t
+++ b/t/real/gingko.t
@@ -83,7 +83,7 @@
is($meta->{A_gingko_article_DOI}, 'data:application/x.korap-link;title=doi%3A10.1007%2FBF03221854,https%3A%2F%2Fdoi.org%2F10.1007%2FBF03221854', 'Gingko Article DOI');
is($meta->{I_gingko_text_tokens}, '2191', 'Gingko Text Tokens');
is($meta->{A_internal_link}, 'data:application/x.korap-link;title=IDS%20webpage%20on%20Gingko%20in%20the%20DeReKo%20archive,https%3A%2F%2Fwww.ids-mannheim.de%2Fdigspra%2Fkl%2Fprojekte%2Fkorpora%2Farchiv-1%2Fgingko%2F', 'Gingko Internal Link');
-is($meta->{A_external_link}, 'data:application/x.korap-link;title=Gingko-Webseite%20an%20der%20Universit%E4t%20Leipzig,http%3A%2F%2Fwww.uni-leipzig.de%2Fgingko%2F', 'Gingko External Link');
+is($meta->{A_external_link}, 'data:application/x.korap-link;title=Gingko-Webseite%20an%20der%20Universit%C3%A4t%20Leipzig,http%3A%2F%2Fwww.uni-leipzig.de%2Fgingko%2F', 'Gingko External Link');
# Tokenization