0
我有一個具有國際字符的字符串數組。
當我將它保存在數據庫中時,我放鬆了反斜槓?爲什麼?PHP json_encode失去我的UTF-8轉義?
$descr_arr = array("héééllo","world");
$js_encoded = json_encode($descr_arr);
print $js_encoded; // "[\"h\u00e9\u00e9\u00e9llo\",\"world\"]"
$sql_query = "UPDATE test_table SET description = '$js_encoded' WHERE id = 0";
$sql_res = mysql_query($sql_query);
// in the description field in the database I find:
// ["hu00e9u00e9u00e9llo","world"]
謝謝保羅,也爲PDO和ADODb的建議,現在讀它們,乾杯 – FFish 2010-11-12 19:27:51