为什么反回的中文是乱码的?
<P>我用以下程序: <BR> function send_request(url){<BR> http_request=false;<BR> if(window.XMLHttpRequest){<BR> http_request=new XMLHttpRequest();<BR> if(http_request.overrideMimeType){<BR> http_request.overrideMimeType("text/xml");<BR> }<BR> }<BR> else if(window.ActiveXObject){<BR> try{<BR> http_request=new ActiveXObject("Msxml2.XMLHTTP");<BR> }catch(e){<BR> try{<BR> http_request=new ActiveXObject("Microsoft.XMLHTTP");<BR> }catch(e){}<BR> }<BR> }<BR> if(!http_request){<BR> window.alert("not")<BR> return false<BR> }<BR> http_request.onreadystatechange=processRequest;<BR> http_request.open("GET",url,true);<BR> http_request.send(null)<BR> }<BR>function processRequest(){<BR> if(http_request.readyState==4){<BR> if(http_request.status==200){<BR> form1.gwdw.value=http_request.responseText;<BR> }else{<BR> alert("数据传递发生错误!")<BR> }<BR>}}</P><P> function xd()<BR>{<BR> var f=document.form1;<BR> var dw=f.xz.value<BR> i=22<BR> send_request("gwdwdata.asp?dw="+dw)</P>
<P>}<BR>把gwdwdata.asp返回的数据显示在输入框内,可为什么显示的是乱码(中文乱,其它的都好的)呢?<BR>显示内容如下:<BR>??м??ҵ?????˾<BR>我要如何才能让它显示正常呢?</P> var dw=escape(f.xz.value); //escape解决Ajax中文筹码问题<BR><BR>asp文件那加个response.Charset="GB2312" <a href="http://bbs.bc-cn.net/viewthread.php?tid=63454&extra=&page=100" target="_blank" >http://bbs.bc-cn.net/viewthread.php?tid=63454&extra=&page=100</A>#<BR>还以为看到这个贴子就能解决我的问题了<BR>请知道没用,问题一样[em06] <P>看二楼</P> 原来是加在那个数据文件中的.gwdwdata.asp<BR>就是这个文件中的.<BR>OK了!!!!!<BR>谢谢!!!!
页:
[1]
