From: Brian Cassidy Date: Thu, 20 Apr 2006 18:45:55 +0000 (+0000) Subject: uri_with is now utf8-safe X-Git-Tag: 5.7099_04~626 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=fc42a730483499b9ee26ac068ba1c40794b05ebe uri_with is now utf8-safe --- diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index f9ff7b3..0df44fd 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -5,6 +5,7 @@ use base 'Class::Accessor::Fast'; use IO::Socket qw[AF_INET inet_aton]; use Carp; +use utf8; __PACKAGE__->mk_accessors( qw/action address arguments cookies headers match method @@ -502,6 +503,13 @@ sub uri_with { carp( 'No arguments passed to uri_with()' ) unless $args; + for my $value ( values %$args ) { + my $isa_ref = ref $value; + if( $isa_ref and $isa_ref ne 'ARRAY' ) { + croak( "Non-array reference ($isa_ref) passed to uri_with()" ); + } + utf8::encode( $_ ) for $isa_ref ? @$value : $value ; + }; my $uri = $self->uri->clone; $uri->query_form( {