把show create table xxx 看看 MySQL每个字段都可以设置字符集 看看每个字段的字符集是否正确。
在 2010年7月7日 上午11:09,wd <[email protected]>写道: > 使用 dbi DBD::mysql 连 mysql, > > my $dbh = DBI->connect($dsn, $user, $password, > {RaiseError => 1, > mysql_enable_utf8 => 1, > mysql_auto_reconnect => 1} ); > > 已经 enable 了 utf8,但是 sql 里面如果有 where xxx = '中文' 这样的语句就报错, > > DBD::mysql::db selectall_arrayref failed: Illegal mix of collations > (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation > '=' at ./e.pl line 128. > > 尝试 $dbh->do('set names utf8') 没用,不过 set names latin1 就不报了,不过结果不对。。。 > > table 是 ENGINE=InnoDB DEFAULT CHARSET=utf8 > > 把那个 sql 打印出来,然后在 mysql cli 执行就没问题。这怎么弄?有人有经验没? > > -- > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 > 要取消订阅此网上论坛,请发送电子邮件至 > [email protected]<perlchina%[email protected]> > 。 > 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。 > -- Azure.Wang -- 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
