我的数据库存储了一些我必须通过 AJAX 获取的文本。这进展顺利,但仅当它不包含特殊字符(如 ë 或 ä)时。我发现一些关于这个主题的文章告诉我更改 AJAX 请求的字符集,但这些都不适合我。
当我启动萤火虫时,它对标题说:
Antwoordheaders (荷兰语为 responseheaders)
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection close
Content-Length 94
Content-Type text/html; charset=ISO-8859-15
Date Wed, 26 Sep 20 09:52:56 GMT
Expires Thu, 19 Nov 1981 08:52:00 GMT
Pragma no-cache
Server Apache
X-Powered-By PleskLin
Verzoekheaders(requestheaders 的荷兰语)
Accept text/html,application/xhtml+xml,application/xml;q=0.9, / ;q=0.8
Accept-Encoding gzip, deflate
Accept-Language nl,en-us;q=0.7,en ;q=0.3
Authorization Basic c3BvdGlkczp6SkBVajRrcw==
Connection keep-alive
Content-Type text/html; charset=ISO-8859-15
Cookie __utma=196329838.697518114.1346065716.1346065716.1346065716.1; __utmz=196329838.1346065716.1.1.utmcsr=(直接)|utmccn=(直接)|utmcmd=(无); PHPSESSID=2h4vu8gu9v8fe5l1t3ad5agp86
DNT 1
主机 www.spotids.com
引荐来源http://www.spotids.com/private/?p=16
用户代理 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/ 14.0.1
两个标题都在谈论 charset=ISO-8859-15 应该包括像 ë 这样的字符,但它对我不起作用。
我用于此的代码(PHP):
`$newresult = mysql_query($query2); $结果 = 数组(); 而($row = mysql_fetch_array($newresult)) { array_push($result, $row); } $jsonText = json_encode($result); 回声 $jsonText;`