2013-12-08 40 views
0

我想在PHP中的SQL查詢。我正在?????而不是Unicode字符。我經歷了谷歌和stackoverflow,我有很多解決方案,我嘗試了所有這些,但仍然沒有得到正確的結果。但是當我嘗試所有這些?走了,但我得到了「\ u0cb8 \ u0cc1 \ u0cb3 \ u0ccd \ u0caf \ u0ca6 \ u0c95 \ u0cc6 \ u0cb2 \ u0cb5 \ u0」。unicode字符顯示錯誤在PHP SQL查詢結果

<?php 
    //header('Content-Type: text/html; charset=utf-8'); 

    $con = mysql_connect("host","uname","[email protected]"); 
    //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); 
?> 

評論行是我試過的解決方案。

回答

0

以下行寫在頁面

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

嘗試在第一行的頭標記時工作很適合我。這對我來說很有用。

+0

是的,我試過在我的頭上。 http://app.sullia.in/full.php –