即使添加了mysqli_set_charset($ conn,“ utf8”);我也无法从数据库中读取阿拉伯语单词;

时间:2018-11-10 19:18:13

标签: php android

我创建了一个阿拉伯语单词数据库,我可以在数据库中正确写一个阿拉伯语单词。但是当我阅读此阿拉伯语单词时,会返回“ \ u0645 \ u062f \ u062d \ u062a”等字样!但是我正确地写了阿拉伯语单词!

这是我的php文件

<?php

$db_name = "test2";
$mysql_username= "root";
$mysql_password= "";
$server_name = "localhost";
$conn = mysqli_connect($server_name,$mysql_username,$mysql_password,$db_name);


mysqli_set_charset($conn,"utf8");

if(!$conn)
   echo "The application can't connect to the DB"; 

$mysql_qry = "select * from arabictest";
$result = mysqli_query($conn,$mysql_qry);
$FinalArr = array();

$count =0; 
while ( $row = mysqli_fetch_array($result))
{
    $name = $row["name"]; 
    $myArr = array($name);
    $FinalArr[$count] = array(); 
    $FinalArr[$count] = $myArr; 
    $count++;
    $UserData = json_encode($FinalArr);
}
echo $UserData;
?>

结果

output mydatabase

0 个答案:

没有答案