I know that there are lot of questions on this. I have tried many things but I couldn't fix it. Perhaps I failed executing the solutions because of my limited knowledge?
I select data from mysql database and use json_encode() function on it. This works , except for the data which contains special characters(Turkish). For those values , json returns null. How can I fix this?
Here is my simple php code:
<?php
require('init.php');
$sql="SELECT * FROM tablename;";
$result=mysqli_query($con,$sql);
$response=array();
while($row=mysqli_fetch_array($result)){
array_push($response,array("X"=>$row["x"],"Y"=>$row["y"]));
}
echo json_encode($response);
?>
in mysql , columns are set to utf8-turkish. I have tried things like setting headers , calling some functions , recreating php files in utf8 encoding etc.. but none did work.