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

J. Shirley jshirley at gmail.com
Tue Sep 30 16:10:13 BST 2008

On Sat, Sep 27, 2008 at 6:51 AM, Hugh Hunter <hhunter at gmail.com> wrote:
> Hello all,
> I've been struggling with this for some time and know there must be an
> answer out there.
> 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:
> 'name' => 'Jes\xc3\xbas'
> which I think I understand as being perl's internal escaping of utf-8
> characters.
> 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?
> Best regards,
> --Hugh

I haven't dug into the Catalyst source to see of any handling for the
arguments, but just for testing you may want to try doing a
utf8::decode($name) and see if that does the trick for you.

(Wild guessing on my part, sorry)


More information about the Catalyst mailing list