WordPress.org

Ready to get started?Download WordPress

Forums

wp-db.php (1 post)

  1. imjscn
    Member
    Posted 3 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic