Skip Menu |

This queue is for tickets about the URI-Query CPAN distribution.

Report information
The Basics
Id: 132815
Status: new
Priority: 0/
Queue: URI-Query

People
Owner: Nobody in particular
Requestors: JDEGUEST [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.16
Fixed in: (no value)



Subject: utf8 encoding
When providing URI::Query with a query string from a http request, URI::Query calls _parse_qs which url decode the string, but does not ut8 decode it. However, as per W3C standards all http queries now are made with utf8. It would be very simple for URI::Query to utf8 decode the values instead of having the user parse each key-value pair and decode it himself/herself... Here is a patch as a proposed solution. Please note that I have not checked elsewhere in the code if similar changes would be required.
Subject: URI-Query.patch
--- Query.pm 2016-08-10 11:03:33.000000000 +0900 +++ Query-modified.pm 2020-06-13 15:29:55.000000000 +0900 @@ -194,6 +194,8 @@ my $qs = shift; for (split /[&;]/, $qs) { my ($key, $value) = map { uri_unescape($_) } split /=/, $_, 2; + $key = Encode::decode_utf8( $key ) if( !Encode::is_utf8( $key ) ); + $value = Encode::decode_utf8( $value ) if( !Encode::is_utf8( $value ) ); $self->{qq}->{$key} ||= []; push @{$self->{qq}->{$key}}, $value if defined $value && $value ne ''; }