学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
发新话题
打印

为什么反回的中文是乱码的?

为什么反回的中文是乱码的?

我用以下程序:
function send_request(url){
http_request=false;
if(window.XMLHttpRequest){
http_request=new XMLHttpRequest();
if(http_request.overrideMimeType){
http_request.overrideMimeType("text/xml");
}
}
else if(window.ActiveXObject){
try{
http_request=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
http_request=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
if(!http_request){
window.alert("not")
return false
}
http_request.onreadystatechange=processRequest;
http_request.open("GET",url,true);
http_request.send(null)
}
function processRequest(){
if(http_request.readyState==4){
if(http_request.status==200){
form1.gwdw.value=http_request.responseText;
}else{
alert("数据传递发生错误!")
}
}}

function xd()
{
var f=document.form1;
var dw=f.xz.value
i=22
send_request("gwdwdata.asp?dw="+dw)

}
把gwdwdata.asp返回的数据显示在输入框内,可为什么显示的是乱码(中文乱,其它的都好的)呢?
显示内容如下:
??м??ҵ?????˾
我要如何才能让它显示正常呢?

TOP

var dw=escape(f.xz.value); //escape解决Ajax中文筹码问题

asp文件那加个response.Charset="GB2312"

TOP

http://bbs.bc-cn.net/viewthread.php?tid=63454&extra=&page=100#
还以为看到这个贴子就能解决我的问题了
请知道没用,问题一样

TOP

看二楼

TOP

原来是加在那个数据文件中的.gwdwdata.asp
就是这个文件中的.
OK了!!!!!
谢谢!!!!

TOP

发新话题