[Catalyst] Passing UTF-8 arg in URL to DBIC search

Bill Moseley moseley at hank.org
Sat Sep 27 16:38:20 BST 2008

On Sat, Sep 27, 2008 at 09:51:54AM -0400, Hugh Hunter wrote:
> I'm using URL arguments to pass parameters to my controller.  It's a  
> site about names, so take the url http://domain.com/name/Jesús (note  
> the accented u).  The Name.pm controller has an :Args(1) decorator so  
> Jesús is stored in $name and then passed to my DBIC model in a - 
> >search({name => $name}) call.  This doesn't manage to find the row  
> that exists in mysql.  When I dump $name I get:
> I've done everything recommended on 
> http://dev.catalystframework.org/wiki/gettingstarted/tutorialsandhowtos/using_unicode 
>  and the name column in my mysql database uses the utf-8 charset.
> Where am I going wrong?

The plugin does not decode the path, only the query parameters.[1]

I'm not clear on passing utf8 on the path -- I thought you would have
to url-encode it, but maybe the browser will do that. Although, I'm not
clear how it knows what encoding to use.

[1] also note that it doesn't decoded the body params, so if you
access those via the body_parameters request method they won't be
decoded.  Accessing them via ->parameters is ok, though.

Bill Moseley
moseley at hank.org
Sent from my iMutt

More information about the Catalyst mailing list