[Catalyst] Special characters and MySQL issue

Tobias Kremer t at funkreich.de
Fri Aug 25 17:13:30 CEST 2006


I have my content-type header set to ISO-8859-1 because I'm dealing with
legacy data from a latin1 encoded MySQL database (otherwise data from the
database is not displayed correctly in the browser). There's a form on my
site for searching users by attribute. Now here's the problem:

Doing a search where, for instance, firstname = "Müriam" (note the
German umlaut) the search result contains users with a firstname of
Myriam (note the y instead of the german umlaut). I tried to trace down
the problem but was unable to really figure out what is going wrong. The
data from the form is URL-escaped correctly to "M%FCriam". I tried putting
the following in the controller handling the request:

$c->log->warn( $c->request->param( 'value' ) );

and it spits out:

"[warn] M"
(note that everything after the german umlaut is missing - maybe just a
console problem?)

I access the model like this:

my $rs = $model->search_like( {
  $c->request->param( 'attribute' ) => $c->request->param( 'value' )
} );

The mysql query log shows the search string as:

SELECT [...] WHERE [...] LIKE 'M\xfcriam'

Entering a query with this search string manually into the mysql console
client yields no results - as expected because there is no user with a
firstname of Müriam.

Any ideas on what's going on here? :)

Thanks in advance for any help!

Toby



More information about the Catalyst mailing list