[Mediawiki-l] Error in numRows(): Illegal mix of collations

muyuubyou muyuubyou at gmail.com
Sun Feb 5 18:59:20 UTC 2006


Ok, after wasting my weekend and losing faith in mediawiki I think I've
found something.

As explained here:
http://groups.google.com/group/mailing.database.myodbc/browse_thread/thread/f9ac09eec70ed2c5/789159e62b8a1573%23789159e62b8a1573?sa=X&oi=groupsr&start=0&num=2

MySQL4 won't swallow many queries that would work with mySQL3 because it's
pickier about collations.

I found myself in this situation:

mysql> SHOW VARIABLES LIKE 'character_set_%';
+¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¨C+¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª-+
| Variable_name | Value |
+¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¨C+¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª-+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_results | latin1 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | c:\mysql\share/charsets/ |
+¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¨C+¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª-+
7 rows in set (0.00 sec)


mysql> SHOW VARIABLES LIKE 'collation_%';
+¡ª¡ª¡ª¡ª¡ª¡ª¡ª-+¡ª¡ª¡ª¡ª¡ª¡ª-+
| Variable_name | Value |
+¡ª¡ª¡ª¡ª¡ª¡ª¡ª-+¡ª¡ª¡ª¡ª¡ª¡ª-+
| collation_connection | latin1_swedish_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+¡ª¡ª¡ª¡ª¡ª¡ª¡ª-+¡ª¡ª¡ª¡ª¡ª¡ª-+
3 rows in set (0.00 sec)

 To summarize...

In the file includes/Database.php , at the beginning of function doQuery(),
add:

mysql_query("SET NAMES 'utf8¡ä;", $this->mConn );

Otherwise you just can't rely on the names of new pages being in the same
collation (usually latin1). This has given me several different errors and I
wouldn't rule out there might be possible injection attacks due to this.


Please somebody, warn about mySQL4 being not properly tested in bold font in
the requirements section.


On 2/4/06, muyuubyou <muyuubyou at gmail.com> wrote:
>
> Oh BTW I'm using MySQL 4.1, I suspect the problem is there :(
>
> Can you guys try to create a chinese page? try copy-pasting this: hÕZ
>
> On 2/4/06, muyuubyou <muyuubyou at gmail.com > wrote:
> >
> > No, I didn't manually touch that. I just checked it out. Thanks for the
> > swift reply anyway :)
> >
> > On 2/4/06, Brion Vibber < brion at pobox.com> wrote:
> >
> > > muyuubyou wrote:
> > > > When I try to create a Chinese or Japanese page I get this error:
> > > >
> > > >  Error in numRows(): Illegal mix of collations (utf8_bin,IMPLICIT)
> > > and
> > > > (latin1_swedish_ci,COERCIBLE) for operation '='
> > >
> > > Did you change the character set configuration of MySQL or the tables?
> > > Don't do
> > > that. MediaWiki uses UTF-8, but doesn't pay much attention to what
> > > MySQL thinks
> > > the charset is; under the old "latin-1" default it'll run good clean
> > > binary
> > > UTF-8 on top of that with few problems. Under the experimental MySQL 5
> > > mode it
> > > can use tables which are set up as UTF-8. Don't try to mix these
> > > modes.
> > >
> > > -- brion vibber (brion @ pobox.com)
> > >
> > >
> > >
> > > _______________________________________________
> > > MediaWiki-l mailing list
> > > MediaWiki-l at Wikimedia.org
> > > http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
> > >
> > >
> > >
> > >
> >
>


More information about the MediaWiki-l mailing list