[Catalyst] uri_for() doesn't encode to utf8 first argument

Jonathan Rockway jon at jrock.us
Sat May 17 05:53:24 BST 2008


* On Sat, May 17 2008, Dmitriy S. Sinyavskiy wrote:
> It strange I haven't got received letter with this...may be deleted
> by antispam (

Yes, your mailserver rejected my reply.  However, the list did receive
it.

> Nevertheless I've done it now:
>
> Index: Catalyst.pm
> ===================================================================
> --- Catalyst.pm	(revision 7759)
> +++ Catalyst.pm	(working copy)
> @@ -948,10 +948,12 @@
>      my $params =
>        ( scalar @args && ref $args[$#args] eq 'HASH' ? pop @args : {} );
>  
> +    $path =~ s!/+!/!g; # strip extra slashes '///'
> +    unshift(@args, split('/', $path));
>      carp "uri_for called with undef argument" if grep { ! defined $_ } @args;
>      s/([^$URI::uric])/$URI::Escape::escapes{$1}/go for @args;
>  
> -    unshift(@args, $path);
> +    
>  
>      unless (defined $path && $path =~ s!^/!!) { # in-place strip
>          my $namespace = $c->namespace;

OK, but it looks like you forgot the tests. :) However, I think the
patch is sound.  Please check that things like:

  uri_for('/controller/ほげ')
  *click that link*
  
dispatch correctly, though.

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"



More information about the Catalyst mailing list