貌似文件是UTF8的,不要再用use utf8了吧? wd 写道: > use utf8 也不行。文件是 utf8 的 > > 在 2010年7月7日 上午11:39,Kaiwang Chen <[email protected] > <mailto:[email protected]>>写道: > > 硬编码的?use utf8 了吗? > > 在 2010年7月7日 上午11:34,wd <[email protected] <mailto:[email protected]>> > 写道: > >> show full columns from 表名; > > > > 我要比较的字段是 utf8_general_ci > > > >> 字段上没设置,default 就按是表的设置吧。你那 where = '中文' > 是怎么输进去的? > > > > where = '中文' 是拼sql 的时候写进去的 > > $sql = "select xxxxx from xxxxx where xxx='中文'"; 这样 > > > > 尝试了使用 $dbh->prepare, $sth->execute('中文') 这样,也不行。 > > > > > >> > >> 在 2010-07-07 11:19:25,wd <[email protected] <mailto:[email protected]>> > 写道: > >> > >> 字段上面没看到有设置。只有表有。咋回事呢?奇怪。。。 > >> > >> 在 2010年7月7日 上午11:11,azure wang <[email protected] > <mailto:[email protected]>>写道: > >>> > >>> 把show create table xxx 看看 > >>> > >>> MySQL每个字段都可以设置字符集 看看每个字段的字符集是否正确。 > >>> > >>> > >>> 在 2010年7月7日 上午11:09,wd <[email protected] > <mailto:[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 <http://e.pl> line 128. > >>>> > >>>> 尝试 $dbh->do('set names utf8') 没用,不过 set names latin1 > 就不报了,不过结果不对。。。 > >>>> > >>>> table 是 ENGINE=InnoDB DEFAULT CHARSET=utf8 > >>>> > >>>> 把那个 sql 打印出来,然后在 mysql cli 执行就没问题。这怎么 > 弄?有人有经验没? > >>>> > >>> > >>> > >>> -- > >>> Azure.Wang > >>> > > > > >
-- Perl乐事 -- http://www.perlersh.org 我的博客 -- http://www.perlersh.org/blog.html 诸法从缘起,如来说是因。 彼法因缘尽,是大沙门说。 -- 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
