开发者

ajax(search suggest) funny character problem

ajax(search suggest), if input funny character(like Ô) and submit it, "?" is displayed in *****.asp. ( response.write (request.form("str")))

i am using

xmlhttp.open("post", "*****.asp", true);
xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send("str="+escape($("str").value));

and there is <%@CODEPAGE=65001%> in *****.asp file

How 开发者_高级运维can i get the correct word--- "Ô" in *****.asp


escape() is terrible, avoid it at all costs. Try this:

xmlhttp.send("str="+encodeURIComponent($("str").value));

This would encode Ô into %C3%94 - assuming the page decoding it supports utf8 you should be fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜