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 '';
}