From: Marcus Ramberg Date: Fri, 9 May 2008 17:04:23 +0000 (+0000) Subject: query param encoding patch X-Git-Tag: 5.7099_04~80 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f3c95105be13526f9b53220d937bc69e667ed56d;p=catagits%2FCatalyst-Runtime.git query param encoding patch --- diff --git a/Changes b/Changes index 75648c8..afb5adc 100644 --- a/Changes +++ b/Changes @@ -10,6 +10,7 @@ - Fix grammar on welcome page (RT #33236) - Fix for Path('0') handling (RT #29334) - Workaround for Win32 and c3_mro.t (RT #26452, tested by Kenichi Ishigaki) + - Fix for encoding query parameters (eden) 5.7012 2007-12-16 23:44:00 - Fix uri_for()'s and uri_with()'s handling of multibyte chars diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 749d567..2bc2227 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -974,10 +974,10 @@ sub uri_for { if (my @keys = keys %$params) { # somewhat lifted from URI::_query's query_form $query = '?'.join('&', map { + my $val = $params->{$_}; s/([;\/?:@&=+,\$\[\]%])/$URI::Escape::escapes{$1}/go; s/ /+/g; my $key = $_; - my $val = $params->{$_}; $val = '' unless defined $val; (map { $_ = "$_"; diff --git a/t/unit_core_uri_for.t b/t/unit_core_uri_for.t index 0c61435..c767ff2 100644 --- a/t/unit_core_uri_for.t +++ b/t/unit_core_uri_for.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 15; use URI; use_ok('Catalyst'); @@ -58,6 +58,11 @@ is( 'http://127.0.0.1/foo/yada/quux?param1=%E2%98%A0', 'URI for undef action with query params in unicode' ); +is( + Catalyst::uri_for( $context, 'quux', { 'param:1' => "foo" } )->as_string, + 'http://127.0.0.1/foo/yada/quux?param%3A1=foo', + 'URI for undef action with query params in unicode' +); # test with object is(