[Catalyst] Catalyst and UTF-8
Brandon Black
blblack at gmail.com
Wed Nov 29 01:24:39 GMT 2006
On 11/28/06, Jon <jon+catalyst at youramigo.com> wrote:
> I don't know if there is a better high level way to do this in
> DBIx::Class, but should work if you get the dbh from
> DBIx::Class::Storage::DBI.
>
You should have DBIx::Class issue those "SET" statement for you at
connection time via:
http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Storage/DBI.pm#on_connect_do
Using Catalyst::Model::DBIC::Schema, you would put this at the end of
your connect_info configuration, as:
package MyApp::Model::Foo;
use base qw/Catalyst::Model::DBIC::Schema/;
__PACKAGE__->config(
schema_class => 'MySchemaClass',
connect_info => [
'dbi:mysql:dbname=foodb',
'username',
'password',
{
on_connect_do => [
"SET NAMES 'utf8'",
"SET CHARACTER SET 'utf8'"
],
},
],
);
(of course you'd probably do it in YAML or whatever your config method
of choice is)
-- Brandon
More information about the Catalyst
mailing list