我想知道如何使用JSON设置为UTF-8来制作jQuery帖子。现在这是我发送给testimage.php
的JSON。我必须在客户端这么做吗?服务器端与PHP (json_decode()
)?都有?
这就是我想发布的内容:
{
"ff": "news-gothic-std",
"a": "right",
"s": 22,
"words": [{
"t": "trioSkincare's",
"c": "#99cccc",
"fs": "normal",
"fw": "700"
}, {
"t": " 9th",
"c": "#99cccc",
"fs": "normal",
"fw": "700"
}, {
"t": " Anniversary",
"c": "#99cccc",
"fs": "normal",
"fw": "700"
}, {
"t": "John   ",
"c": "#99cccc",
"fs": "normal",
"fw": "700"
}, {
"t": " Smith",
"c": "#99cccc",
"fs": "normal",
"fw": "700"
}, {
"t": "'n",
"c": "#99cccc",
"fs": "normal",
"fw": "700"
}],
"w": 277,
"h": 46
}
首先要确保你的页面有:
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
这将使所有数据作为JSON utf-8发布。如果要将数据存储到表中请确保表的排序规则设置为utf8_general_ci