<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">Hi Andrew,<br><br>&gt;&gt;&gt;&nbsp; That’s not gibberish, it’s UTF-8 being treated as if it was Latin-1. For<br>instance, “惯” is “惯”. I&nbsp; think this problem is very likely at the browser end.<br>Check this by looking at how your browser is treating the pages. My guess is that it<br>is set to “Western (ISO 8859-1)”. If you change the encoding to “UTF-8”, you<br>should see the Chinese characters. CQPweb does issue an HTTP header declaring<br>the encoding of each page as UTF-8. However, I don’t know the details of how<br>different browsers respond to that header; it’s possible your browser is set up to<br>enforce some other encoding.<br><br>I double checked those pages and find my browser (firefox 10.0.2) sets them<br>exactly to UTF-8. But the problem persists.<br><br>What's puzzling me is that if the culprit is the browser, why the stand query/restricted<br>query pages yield good results (the brower's character set on the corresponding<br>pages is also UTF-8)?&nbsp; To my knowledge,a same browser is unlikey to treat pages discriminanlty if<br>their original encodings are enforced to be indentical (UTF-8 in this case).<br><br>What's more puzzling is from the MySQL command line, which says the Chinese<br>characters are stored there in good shape:<br>mysql&gt; select * from freq_corpus_test_word;<br>+------+-----------+<br>| freq | item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>+------+-----------+<br>...<br>|&nbsp;&nbsp;&nbsp; 2 | 。&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>|&nbsp;&nbsp;&nbsp; 3 | 的&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>|&nbsp;&nbsp;&nbsp; 1 | 网友&nbsp;&nbsp;&nbsp; |<br>|&nbsp;&nbsp;&nbsp; 1 | 爱好者 |<br>|&nbsp;&nbsp;&nbsp; 1 | 表示&nbsp;&nbsp;&nbsp; |<br>...<br>25 rows in set (0.00 sec)<br><br>So what's the real story? <br><br>&nbsp;&gt;&gt;&gt;The sort order used is the MySQL utf8_general_ci collation – which is far from<br>satisfactory, but which is generally the best of a bad bunch for most purposes. I have<br>plans for a replacement, but they are too big for this margin. I don’t know how<br>utf8_general_ci works for Chinese I’m afraid, and a google does not turn up<br>anything. I suspect it might be binary ordering.<br><br>I googled some Chinese pages regarding MySQL's sorting mechanism and find<br>some info, which might be helpful in our situation (although I haven't tried them myself).<br><br>Page ranked 1st, 3rd. change the columns storing Chinese into gbk (compiling mysql<br>with the directive --with--charset=gbk&nbsp; or --with--charset=gb2312) to make it PINYIN aware.<br><br>SELECT * FROM table ORDER BY CONVERT( chinese_field USING gbk )<br><br>http://www.chinaunix.net/jh/17/15706.html<br>http://topic.csdn.net/u/20080730/11/32a3a5a3-40a9-4240-b2f6-64c6d230d302.html<br><br>While a page ranked 2nd refers to another page at<br>http://blog.chinaunix.net/space.php?uid=259788&amp;do=blog&amp;id=2139261&nbsp; (a page encoded in gbk)<br><br>Basically, it recommends to sets up another PINYIN column in MySQL by <br>extracting the PINYIN of a character automatically, using a function as illustrated on<br>that page.<br><br>Best,<br>Ray<br><br><br></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>