X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=1026625dce78c22b8ae16306c45afe88f655ecd6;hp=d75651498db854890d30860fc1e04e150e3ada6b;hb=5789a3d8e83afb0a0232d4f2a2617353497cd976;hpb=e669e88a53601a58917a17f6bec1822262225ab6 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index d756514..1026625 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -22,6 +22,7 @@ use Scalar::Util qw/weaken blessed/; use Tree::Simple qw/use_weak_refs/; use Tree::Simple::Visitor::FindByUID; use attributes; +use utf8; use Carp qw/croak/; __PACKAGE__->mk_accessors( @@ -854,6 +855,14 @@ sub uri_for { my $params = ( scalar @args && ref $args[$#args] eq 'HASH' ? pop @args : {} ); + for my $value ( values %$params ) { + my $isa_ref = ref $value; + if( $isa_ref and $isa_ref ne 'ARRAY' ) { + croak( "Non-array reference ($isa_ref) passed to uri_for()" ); + } + utf8::encode( $_ ) for $isa_ref ? @$value : $value; + }; + # join args with '/', or a blank string my $args = ( scalar @args ? '/' . join( '/', @args ) : '' ); $args =~ s/^\/// unless $path;