2017-06-22 14 views
2

mySqlデータベースから自分のサイトにユニコードのテキストを表示したい、ユニコード照合のテーブルを作成しましたが、ユニコードテキストでテキストを表示できません。作成したコードを参考にしてください。phpのmySQLテーブルからUnicodeテキストを表示する方法は?

<!Doctype html> 
<html> 
<head> 
<title>Example</title> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<style> 
*{ 
    font-family:Latha; 
} 
</style> 
</head> 
<body> 
<?php 
    $servername = "localhost"; 
    $username = "root"; 
    $password = ""; 
    $dbName = "mydb"; 

    //Create connection 
    header("content-type: text/html; charset=UTF-8"); 
    $conn = new mysqli($servername, $username, $password, $dbName); 

    //Check connection 
    if($conn->connect_error){ 
     die("Connection Failed : ". $conn->connect_error); 


    } 



    $sql="select txt, txt1,txt2 from dav"; 
    //mysqli_set_charset($sql, 'utf8'); 
    $result=$conn->query($sql); 

    if($result->num_rows>0){ 
     //output data 
     while ($row=$result->fetch_assoc()){ 
      echo "<div><p>" .$row["txt"]. "</p><p>" .$row["txt1"]. "</p><p>" . $row["txt2"]. "</p></div>"; 
     } 

    } 
    else{ 
     echo "No data found"; 
    } 
    $conn->close(); 
?> 

</body> 
</html> 

と出力この

のようなものです?????????? ????? ?????? ???????? ??????????? ????????? ??????。

????????? ????? ?????? ???????? ??????????? ????????? ??????。

????????? ????? ?????? ???????? ??????????? ????????? ??????。

しかし、私はこの

வான்நின்றுஉலகம்வழங்கிவருதலால்தான்அமிழ்தம்என்றுணரற்பாற்றுようにしたいです。 வான்ġின்றன்ற்்லகம்வழங்கிவாுதலால்தான்அமிழ்தம்என்றுணரற்பாற்றுு。 வான்ġின்றன்ற்்லகம்வழங்கிவாுதலால்தான்அமிழ்தம்என்றுணரற்பாற்றுு。

この問題を解決してください。

+0

私はこの問題を次の行で修正しました: "mysqli_set_charset($ conn、 'utf8');" – Sathishkumar

+1

http://stackoverflow.com/questions/38363566/trouble-with- utf8-characters-what-i-see-is-what-i-stored –

答えて

0

私はそのが正常に動作します怒鳴るライン

mysqli_set_charset($conn, 'utf8'); 

を追加することによってこの問題を解決します。

関連する問題