From: Byron Jones Date: Mon, 30 May 2011 08:20:32 +0000 (+0800) Subject: Bug 659816: Fix url_decoding of utf8 strings X-Git-Tag: bugzilla-4.0.2~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8dfcbc25ff68522f974a952dd36ba4b71bb9e215;p=thirdparty%2Fbugzilla.git Bug 659816: Fix url_decoding of utf8 strings r=mkanat, a=mkanat --- diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index b1655f7ca0..1129cb0ae6 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -240,14 +240,11 @@ sub xml_quote { return $var; } -# This function must not be relied upon to return a valid string to pass to -# the DB or the user in UTF-8 situations. The only thing you can rely upon -# it for is that if you url_decode a string, it will url_encode back to the -# exact same thing. sub url_decode { my ($todecode) = (@_); $todecode =~ tr/+/ /; # pluses become spaces $todecode =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; + utf8::decode($todecode) if Bugzilla->params->{'utf8'}; return $todecode; }