我把一些數據在我的MySQL數據庫中工作正常。 但是,當我與json_encode的數據,我得到IST回來這樣的:json_encode utf8
{"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"}
你看"road":"Wittener Stra\u00dfe"
是不正確的名稱就必須Wittener大街
我的代碼:
<?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);
?>
什麼是錯的?
這是不正確的,因爲'\ u00df'是德國尖銳S(ß)的JSON轉義序列。問題的關鍵是逃避真正需要的,如果不是如何避免。 – Codo