I have some persian data in my mysql database, the retrieved data contains C/C++/Java Source Code encoded data for persian values as below;
{"server_response":[{"hp_number":"09301234567","name":"\u0633"}]} while in name column there is a persian character (س).
the php code is as below:
<?php
require "init.php";
$hp_no = "09301234567";
mysqli_set_charset($con,"utf8");
$sql = "select * From users Where hp_number = ('$hp_no');";
$result = mysqli_query($con,$sql);
$response = array();
while ($row = mysqli_fetch_array($result)) {
array_push($response,array("hp_number"=>$row[1],"name"=>$row[3]));
}
echo json_encode(array("server_response"=>$response));
mysqli_close($con);
?>
on mysql side encoding is set as utf8_general_ci for both table and database itself and is presented perfectly with no issue.
Thanks in advance for your helps and suggestions.