【发布时间】:2011-10-07 08:47:55
【问题描述】:
我有一个从数据库中获取的 ISO 字符串,当我对它进行 utf8_encode 时,我得到一个 \u00f6 而不是 Ö。这混淆了 ajaxes 这个 PHP 脚本的 javascript/html。为什么有 \u00f6 而不是 Ö?如何获得 Ö?
编辑: 好的,我做了更多的实验,结果发现这是由 utf8_encode 和 json_encode 的组合引起的。虽然如果我根本不使用 utf8_encode,那么 json 中的值将为 null。
json_encode(array("city"=>utf8_encode("göteborg")))
【问题讨论】:
-
从你的 ajax 页面粘贴你的 php 代码来进行转换和打印。