ajax中文乱码问题在中文中经常会出现这种问题,其实只要稍加注意就不会出现ajax中文乱码这回事情了,注意前后台编码一致.你用的是中文.而ajax传输数据的时候用的是utf-8 ,还有对ajax get方法时最好escape 或urlcode, 
复制代码 代码如下:
 
<%@ page contenttype="text/html;charset=gb2312%> 
复制代码 代码如下:
 
response.setcontenttype("text/html;charset=gb2312"); 
request.setcharacterencoding("gb2312"); 
复制代码 代码如下:
 
response.setcontenttype("text/html;charset=gb2312"); 
request.setcharacterencoding("gb2312"); 
复制代码 代码如下:
 
string param = request.getparamter("param"); 
param = new string(param.getbytes("iso-8859-1"),"gb2312"); 
复制代码 代码如下:
 
<script> 
var oxmlhttp = new activexobject( "microsoft.xmlhttp "); 
oxmlhttp.open( "get ", "http://dotnet.aspx.cc/content.aspx ", false); 
oxmlhttp.send() 
var ostream = new activexobject( "adodb.stream "); 
if(ostream == null) 
alert( "您的机器不支持adodb.stream. ") 
else 
{ 
ostream.type=1; 
ostream.mode=3; 
ostream.open() ; 
ostream.write(oxmlhttp.responsebody); 
ostream.position= 0; 
ostream.type= 2; 
ostream.charset= "gb2312 "; 
var result= ostream.readtext(); 
ostream.close(); 
ostream = null; 
alert( result); 
} 
</script> 
复制代码 代码如下:
 
<meta http-equiv="content-type" content="text/html; charset=gb2312" /> 
复制代码 代码如下:
 
response.setheader("content-type","text/html; charset=gb2312"); 
复制代码 代码如下:
 
string username = new string(request.getparameter("username").getbytes("iso8859_1"),"gb2312"); 
复制代码 代码如下:
 
string username = new string(request.getparameter("username").getbytes("iso8859_1"),"gb2312"); 
复制代码 代码如下:
 
string username = new string(request.getparameter("username").getbytes("iso8859_1"),"utf-8"); 
新闻热点
疑难解答
图片精选