解决XMLHTTP中中文字符传递乱码的问题
2005-02-05 14:55
411 查看
<%
'-----------send.asp-----------------------
set xmlhttp=server.createObject("Microsoft.XMLHTTP")
xmlhttp.open "post","http://localhost/sm/get.asp",false
xmlhttp.setRequestHeader "content-type","text/xml"
xmlhttp.send "<?xml version='1.0'?><a> 如何解决XMLHTTP提交过时返回的是乱码,这是先提交上去,再返回的文字。</a>"
response.write xmlhttp.responseXML.xml
%>
<%@ Language=VBScript %>
<%
'--------------------get.asp---------------------
Response.ContentType = "text/xml"
Response.CharSet = "GB2312"
Dim varCount,varReq,xmldom
varCount = Request.TotalBytes
varReq = Request.BinaryRead(varCount)
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Set xmldom = Server.CreateObject("MSXML2.DOMDocument")
xmldom.load varReq
Response.Write "<?xml version=""1.0"" encoding=""GB2312""?>" & xmldom.documentElement.xml
Else
Response.Write "<?xml version=""1.0"" encoding=""GB2312""?><a>如何解决XMLHTTP提交过时返回的是乱码,这是从服务器直接返回的文字。</a>"
End If
%>
'-----------send.asp-----------------------
set xmlhttp=server.createObject("Microsoft.XMLHTTP")
xmlhttp.open "post","http://localhost/sm/get.asp",false
xmlhttp.setRequestHeader "content-type","text/xml"
xmlhttp.send "<?xml version='1.0'?><a> 如何解决XMLHTTP提交过时返回的是乱码,这是先提交上去,再返回的文字。</a>"
response.write xmlhttp.responseXML.xml
%>
<%@ Language=VBScript %>
<%
'--------------------get.asp---------------------
Response.ContentType = "text/xml"
Response.CharSet = "GB2312"
Dim varCount,varReq,xmldom
varCount = Request.TotalBytes
varReq = Request.BinaryRead(varCount)
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Set xmldom = Server.CreateObject("MSXML2.DOMDocument")
xmldom.load varReq
Response.Write "<?xml version=""1.0"" encoding=""GB2312""?>" & xmldom.documentElement.xml
Else
Response.Write "<?xml version=""1.0"" encoding=""GB2312""?><a>如何解决XMLHTTP提交过时返回的是乱码,这是从服务器直接返回的文字。</a>"
End If
%>
相关文章推荐
- JavaScript(js) 前台 参数传递乱码 转码 问题--已解决! 中文字符乱码
- JSP解决地址栏中传递中文字符乱码的问题
- JSP解决地址栏中传递中文字符乱码的问题
- IE浏览器用GET方式传递中文字符出现乱码问题的解决方法
- JavaScript(js) 前台 参数传递乱码 转码 问题--已解决! 中文字符乱码
- IE浏览器用GET方式传递中文字符出现乱码问题的解决方法
- javascript解决中文传递乱码和特殊字符问题
- java 解决全站字符乱码(POST和GET中文编码问题)
- jquery.ajax的url中传递中文乱码问题的解决方法
- 解决jquery ajax中文传递到后端出现乱码问题 java
- php 解决substr()截取中文字符乱码问题
- php 中文字符入库或显示乱码问题的解决方法
- AJAX利用javascript向后台传递中文字符出现乱码解决方法。
- 用ajax传递参数时遇到中文乱码问题的解决方法
- 解决地址栏传递中文属性参数的乱码问题------tomcat服务器
- MySQL字符集中文乱码终极解决方案和mysql查询中文问题解决方法[转贴]
- C# webconfig配置解决post 传递中文参数乱码问题
- 通过JS传递中文解决在Action中乱码问题
- Hibernate向mysql中保存中文字符出现乱码问题的解决
- Java与C之间通过JNI传递中文字符乱码解决