I have a simple mysql database table and php script.
With my php script i get data from DB and write it into an array.
<?php
header('Content-Type: application/json; charset=utf-8');
include "db.php";
$data=array();
$query=mysqli_query($con,"select * from table");
while ($row=mysqli_fetch_object($query)){
$data[]=$row;
}
echo json_encode($data);
?>
If there are no German Umlaute, like "ä" or "ü" in my DB, the JSON string works fine.
Example:
[{"id":"1","kopfzeile":Test,"titel":"Test","beschreibung":"Test"}]
But if there are German Umlaute, like "ä" or "ü", in my DB, i get the value NULL in my JSON string
[{"id":"1","kopfzeile":null,"titel":"null","beschreibung":"null"}]
I want a JSON like this:
[{"id":"1","kopfzeile":Über,"titel":"Hallü","beschreibung":"ÖÜÄ"}]
How to fix this issue?