PHP显示捷克语char

时间:2016-07-05 13:52:13

标签: php mysql encoding special-characters

我试图在MySql数据库中显示包含COLLATION utf8_general_ci特殊字符的数据。

我的PHP代码:

    $serveur = "***.***";
    $login = "login";
    $pwd = "pwd";

    $base = "base";
    $table = "table";

    $id = $_GET["id"];

    mysql_connect ($serveur,$login,$pwd);
    mysql_select_db ($base);

    $sql = "SELECT * FROM ".$table." WHERE tableid = ".$id;
    $req = mysql_query($sql);
    $data = mysql_fetch_assoc($req);

    $name = htmlspecialchars($data[fullname],UTF-8);

    $obj = new stdClass();
    $obj->fullname = $name;

    echo json_encode($obj);
    mysql_close();

显示的"全名"删除特殊字符。

0 个答案:

没有答案