From: Christian Walde Date: Sat, 24 Dec 2011 01:35:25 +0000 (+0100) Subject: all query body parameters are now decoded from UTF8 to Perl's text string format... X-Git-Tag: v0.012~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FWeb-Simple.git;a=commitdiff_plain;h=2993003a82967816ef63c055f39ba90fb34274ac all query body parameters are now decoded from UTF8 to Perl's text string format to allow proper UTF8 processing (regexes, etc.) --- diff --git a/lib/Web/Dispatch/ParamParser.pm b/lib/Web/Dispatch/ParamParser.pm index e8ed581..0f403aa 100644 --- a/lib/Web/Dispatch/ParamParser.pm +++ b/lib/Web/Dispatch/ParamParser.pm @@ -3,6 +3,8 @@ package Web::Dispatch::ParamParser; use strict; use warnings FATAL => 'all'; +use Encode 'decode_utf8'; + sub UNPACKED_QUERY () { __PACKAGE__.'.unpacked_query' } sub UNPACKED_BODY () { __PACKAGE__.'.unpacked_body' } sub UNPACKED_BODY_OBJECT () { __PACKAGE__.'.unpacked_body_object' } @@ -102,8 +104,9 @@ sub get_unpacked_uploads_from { my ($name, $value); foreach my $pair (split(/[&;](?:\s+)?/, $params)) { next unless (($name, $value) = split(/=/, $pair, 2)) == 2; - + s/$DECODE/$hex_chr{$1}/gs for ($name, $value); + $_ = decode_utf8 $_ for ($name, $value); push(@{$unpack{$name}||=[]}, $value); }