阿拉伯语文字显示为问号

时间:2015-05-03 23:38:59

标签: php html mysqli

我希望我的PHP代码和数据库支持阿拉伯语,但它会告诉我???? ,这是我的代码,我确保数据库和表是utf8_general_ci整理。我尝试了一切,没有任何作用。我的php.ini文件默认为uft8。我真的开始认为这将永远不会奏效。

<html>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<?php
$mysqli = new Mysqli("localhost","","", "") or mysqli_error($mysqli);
mysqli_query("SET NAMES 'utf8'");
mysqli_query('SET CHARACTER SET utf8');
mysqli_set_charset('utf8', $mysqli); 
$sql = "SELECT Name FROM Mothakirat"; // This SQL statement selects ALL from the table 'Locations'

if ($result = mysqli_query($mysqli, $sql)) // Check if there are results
{
    $resultArray = array();     // If so, then create a results array and a temporary one
    $tempArray = array();           // to hold the data

    while ($row = $result->fetch_assoc()) // Loop through each row in the result set    
    { 
        $tempArray = $row;    // Add each row into our results array
        array_push($resultArray, $tempArray);
    }
    echo json_encode($resultArray);     // Finally, encode the array to JSON and output the results
}

mysqli_close($con); // Close connections
?>
</html>

2 个答案:

答案 0 :(得分:0)

尝试使用UTF-8转换文件!

enter image description here

对我而言,即使我头脑中有“utf 8”,它也不会显示出那些特殊的法国字符。

答案 1 :(得分:0)

您对bunny.dens <- kde3d(rep(bunny[,1], 10), # increase density. rep(bunny[,2], 10), rep(bunny[,3], 10), n=400, lims=c(-.1,.2,-.1,.2,-.1,.2)) bunny.mesh <- vcgIsosurface(bunny.dens$d, threshold=600) shade3d(vcgSmooth(bunny.mesh,"HC",iteration=1), col="pink") 的来电可能没有做任何事情。见http://php.net/manual/en/function.mysql-query.php你没有传递第二个参数。我可能会使用PDO来解决这个问题:

mysql_query()