【发布时间】:2016-05-11 10:02:52
【问题描述】:
我正在使用以下代码从页面获取 JSON 并将其解析为我的 HTML 页面。 JSON 未以 UTF-8 显示,因此具有奇怪的字符。怎么去掉奇怪的字符?
$.get("test.php", function (data) {
var JSON = jQuery.parseJSON(data);
$.each(JSON.deals.items, function (index, value) {
// My code
});
});
【问题讨论】:
-
您能发布一个 JSON 示例吗?
-
这里有一个生成json的链接oxhey.wc.lt/test.php
-
您指的是
title属性中的Unicode 字符吗?例如\u00c2\u00a314.99?如果是这样,this question 可能会有所帮助,但如果可能,最好更改服务器上的编码。 -
@RoryMcCrossan 那不可能
-
我在php文件中使用file_get_contents
标签: javascript php jquery json utf-8