On Thu, Aug 01, 2013 at 10:28:41AM +0300, Gabor Szabo wrote: > On Wed, Jul 31, 2013 at 7:39 PM, Meir Guttman <m...@guttman.co.il> wrote: > > Dear Gabor, > > You must include «mysql_enable_utf8 => 1» hash record in the connection > > attributes used when you create the DBI handle > > my %conn_attrs = (RaiseError => $RaiseError, > > PrintError => $PrintError, > > AutoCommit => $AutoCommit, > > mysql_enable_utf8 => 1); > > my $dbh = DBI->connect > > ($dsn, $user_name, $password, \%conn_attrs); > > That worked. Great. Thank you! > > This was entirely unclear to me from the docs that it needs to be a > separate key as I looked a couple of lines above the documentation of > mysql_enable_utf8 where it showed another key, mysql_use_result, being > in the actual connection string.
That seems like a bug. Either it's a bug that mysql_enable_utf8=1 in the DSN should work, or it's a bug that unrecognized items in the DSN should warn. There is another, little-used, DSN style that might help: DBI:mysql(mysql_enable_utf8=1):database=$attr->{database};host=$attr->{host} The attributes after the driver name are extracted by the DBI and applied to the $dbh returned from the drivers' connect method. (So can't be used for attributes that need to be applied before the connection is established.) You can see it documented in https://metacpan.org/module/DBI#parse_dsn and the connect section below it. Tim.