php-sql查询结果中出现错误的unicode字符


unicode character showing wrong in php sql query result

我正在php中尝试一个sql查询。我得到了?????而不是Unicode字符。我浏览了谷歌和stackoverflow,在那里我找到了很多解决方案,我尝试了所有的解决方案,但仍然没有得到正确的结果。但当我尝试了所有这些????但我得到了"''u0cb8''u0cc1''u0cb3''u0ccd''u0caf''u0ca6''u0c95''u0cc6''u0cb2''u0cb5''u0"。

<?php
    //header( 'Content-Type: text/html; charset=utf-8' ); 
    $con = mysql_connect("host","uname","pass@");
    //mysql_query("SET NAMES 'utf8'" ,$con);
    //mysql_set_charset('utf8', $con);
    //mysql_set_charset('utf8');
    //mysql_query ("set collation_connection='utf8_general_ci'"); 
    if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db("db", $con);
    //mysql_query ("set character_set_results='utf8'"); 
    //mysql_query("SET NAMES utf8");
    $result = mysql_query("SELECT * FROM node");

    while($row = mysql_fetch_assoc($result))
    {
        $output[]=$row;
    }
    //utf8_encode($output);
    print(json_encode($output));
    //print_r $output;
    mysql_close($con);
?>

评论行是我尝试过的解决方案。

当在页面的head标签中写入时,以下行对我来说很好

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />      

在第一行试试。它对我来说效果很好。