I put some Data in my mysql DB that works fine.
But when I get the Data with json_encode I get ist back like this:
{"idpostdata":"49","artID":null,"timestamp":"06.11.2012 13:35","lat":"51.496911","lon":"7.4022327","cellID":null,"road":"Wittener Stra\u00dfe","suburb":"Eichlinghofen","city":"Dortmund","postdatacol":null,"state_district":"Regierungsbezirk Arnsberg","state":"North Rhine-Westphalia","country_code":"de"}
you see "road":"Wittener Stra\u00dfe" is not the correct name it must Wittener Straße
My Code:
<?php
$sql = mysql_query("SELECT * FROM postdata");
while ($ds = mysql_fetch_assoc($sql))
$output[]=$ds;
echo "{uTraf:";
print(json_encode($output));
echo "}";
mysql_close($dz);
?>
What is wrong?
Nothing.
\uxxxxis JSON’s way of encoding UTF-8 characters.It will look all right again when you decode the JSON using a proper JSON decoding method.