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.
精彩评论