i have a Persian data base that use collection utf8-general-ci but when i run below code i face with ???? instated of Persian words .
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
$conn = new mysqli("localhost", "root", "", "testinsta");
$result = $conn->query("SELECT m_1, m_2, m_3 FROM codecode");
mysqli_query($conn, "SET NAMES utf8");
$outp = "";
while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
if ($outp != "") {$outp .= ",";}
$outp .= '{"Name":"' . $rs["m_1"] . '",';
$outp .= '"City":"' . $rs["m_2"] . '",';
$outp .= '"Country":"'. $rs["m_3"] . '"}';
}
$outp ='{"records":['.$outp.']}';
$conn->close();
echo($outp);
?>
mysql to json with php problem