summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/URI/Escape.pm
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-04-26 22:16:26 +0000
committerKarl Berry <karl@freefriends.org>2015-04-26 22:16:26 +0000
commit342e672574c4e67d510e46ab6acd0e21a7d0cf54 (patch)
tree79e04202d08c0404bbd780bd26c1e34710e539b6 /Master/tlpkg/tlperl/lib/URI/Escape.pm
parentbe2706af7c57a0ef0f4d4e9f684ca4ef74922a82 (diff)
(tl)perl 5.20.2 for windows, from siep
git-svn-id: svn://tug.org/texlive/trunk@37064 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/URI/Escape.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/URI/Escape.pm18
1 files changed, 15 insertions, 3 deletions
diff --git a/Master/tlpkg/tlperl/lib/URI/Escape.pm b/Master/tlpkg/tlperl/lib/URI/Escape.pm
index e09d76acc48..547535ea801 100644
--- a/Master/tlpkg/tlperl/lib/URI/Escape.pm
+++ b/Master/tlpkg/tlperl/lib/URI/Escape.pm
@@ -1,5 +1,7 @@
package URI::Escape;
+
use strict;
+use warnings;
=head1 NAME
@@ -135,8 +137,7 @@ it under the same terms as Perl itself.
=cut
-require Exporter;
-our @ISA = qw(Exporter);
+use Exporter 'import';
our %escapes;
our @EXPORT = qw(uri_escape uri_unescape uri_escape_utf8);
our @EXPORT_OK = qw(%escapes);
@@ -201,8 +202,19 @@ sub uri_unescape {
$str;
}
+# XXX FIXME escape_char is buggy as it assigns meaning to the string's storage format.
sub escape_char {
- return join '', @URI::Escape::escapes{$_[0] =~ /(\C)/g};
+ # Old versions of utf8::is_utf8() didn't properly handle magical vars (e.g. $1).
+ # The following forces a fetch to occur beforehand.
+ my $dummy = substr($_[0], 0, 0);
+
+ if (utf8::is_utf8($_[0])) {
+ my $s = shift;
+ utf8::encode($s);
+ unshift(@_, $s);
+ }
+
+ return join '', @URI::Escape::escapes{split //, $_[0]};
}
1;