Chinese character display problem

Meet this problem again! One friend told me that his comment in Chinese results to an error display. I made the screen snap of this:

Though my blog is based on pure English, there is still many visitors from China. So I can not and should not ask them to make comments in English. This problem must be solved quickly.

With the help of google again, I find the key command which control the codec of the character display. So if you meet the same problem, here is the easy way.

The file is \wp-includes\wp-db.php. Yes, from the file name we can know it interacts with the dbase (wordpress uses mysql, a great free dbase system).

  • Use any text Editor to open it (notepad from windows can work well).
  • Search and find the string “$this->dbh” (no quotation marks in search).
  • Add a new line under it, with the content: $this->query(”SET NAMES ‘gbk’”);
  • Save it and everythink is ok
  • In fact, the only thing we should do it to make the two sides same: codeing of the dbase, and the decoing of the php command. In my system, they are both GBK.


    ——
    ·本文由 iamcj 原创,采用“CC创作共用”方式共享

    Comments

    2 Responses to “Chinese character display problem”

    1. cool on 4月 11th, 2006 9:30

      Can u see the chinese character in MySQL?

    2. iamcj on 4月 11th, 2006 14:13

      When error coding, both mysql and here show mistakes. After adding the line, both are ok:)

    Leave a Reply