diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/URI.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/URI.pm | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/Master/tlpkg/tlperl/lib/URI.pm b/Master/tlpkg/tlperl/lib/URI.pm index c0285a7097c..eb1970eab99 100644 --- a/Master/tlpkg/tlperl/lib/URI.pm +++ b/Master/tlpkg/tlperl/lib/URI.pm @@ -2,7 +2,7 @@ package URI; use strict; use vars qw($VERSION); -$VERSION = "1.58"; +$VERSION = "1.60"; use vars qw($ABS_REMOTE_LEADING_DOTS $ABS_ALLOW_RELATIVE_SCHEME $DEFAULT_QUERY_FORM_DELIMITER); @@ -90,6 +90,7 @@ sub _uric_escape { my($class, $str) = @_; $str =~ s*([^$uric\#])* URI::Escape::escape_char($1) *ego; + utf8::downgrade($str); return $str; } @@ -218,6 +219,7 @@ sub opaque my $new_opaque = shift; $new_opaque = "" unless defined $new_opaque; $new_opaque =~ s/([^$uric])/ URI::Escape::escape_char($1)/ego; + utf8::downgrade($new_opaque); $$self = defined($old_scheme) ? $old_scheme : ""; $$self .= $new_opaque; @@ -243,6 +245,7 @@ sub fragment my $new_frag = shift; if (defined $new_frag) { $new_frag =~ s/([^$uric])/ URI::Escape::escape_char($1) /ego; + utf8::downgrade($new_frag); $$self .= "#$new_frag"; } $old; @@ -470,7 +473,7 @@ argument, it updates the corresponding component in addition to returning the old value of the component. Passing an undefined argument removes the component (if possible). The description of each accessor method indicates whether the component is passed as -an escaped or an unescaped string. A component that can be further +an escaped (percent-encoded) or an unescaped string. A component that can be further divided into sub-parts are usually passed escaped, as unescaping might change its semantics. @@ -1050,7 +1053,13 @@ delimited by ";" instead of "&" which is the default. =head1 BUGS -Using regexp variables like $1 directly as arguments to the URI methods +There are some things that are not quite right: + +=over + +=item * + +Using regexp variables like $1 directly as arguments to the URI accessor methods does not work too well with current perl implementations. I would argue that this is actually a bug in perl. The workaround is to quote them. Example: @@ -1058,6 +1067,19 @@ them. Example: /(...)/ || die; $u->query("$1"); + +=item * + +The escaping (percent encoding) of chars in the 128 .. 255 range passed to the +URI constructor or when setting URI parts using the accessor methods depend on +the state of the internal UTF8 flag (see utf8::is_utf8) of the string passed. +If the UTF8 flag is set the UTF-8 encoded version of the character is percent +encoded. If the UTF8 flag isn't set the Latin-1 version (byte) of the +character is percent encoded. This basically exposes the internal encoding of +Perl strings. + +=back + =head1 PARSING URIs WITH REGEXP As an alternative to this module, the following (official) regular |