Support » Plugins and Hacks » Hacks » wp-db.php

  • I am using WP English version. I need to output some Asia charactors- some of them become question marks on my blog(strangely, it’s not all question marks).
    After some searching, I found a solution online– add a function in wp-db.php , and call the function in wp-settings.php
    Unfortunately, the solution on the website is written this way:
    function set_charset($charset){ // check mysql version first. $serverVersion = mysql_get_server_info($this->dbh); $version = explode('.', $serverVersion); if ($version[0] < 4) return; // check if utf8 support was compiled in $result = mysql_query("SHOW CHARACTER SET like 'utf8'", $this->dbh); if (mysql_num_rows($result) < = 0) return; if ($charset == 'utf-8' || $charset == 'UTF-8') $charset = 'utf8'; @mysql_query("SET NAMES '$charset'", $this->dbh); }
    The second place commented out by // , I don’t know where the comment finish.
    So, I tried this way:

    function set_charset($charset){ // check mysql version first.
    $serverVersion = mysql_get_server_info($this->dbh);
    $version = explode('.', $serverVersion);
    if ($version[0] < 4) return; // check if utf8 support was compiled in $result = mysql_query("SHOW CHARACTER SET like 'utf8'", $this->dbh);
    if (mysql_num_rows($result) < = 0) return;
    if ($charset == 'utf-8' || $charset == 'UTF-8') $charset = 'utf8'; @mysql_query("SET NAMES '$charset'", $this->dbh); }

    This get error message that the 4th line is wrong.

    Could anybody help me figure out where the 2nd comment ends?

  • The topic ‘wp-db.php’ is closed to new replies.