corruptio fractured:Microsoft.XMLHTTP出现乱码怎么办

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/01 23:17:07
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
Microsoft.XMLHTTP出现乱码怎么办
以下是我的源代码,在加什么才可以正常显示?
<%
Dim objXMLHTTP, xml
Set xml = Server.CreateObject("Microsoft.XMLHTTP")

xml.Open "GET", "http://www.baidu.com/index.html", False
' Pull the data from the web page
xml.Send

Response.Write xml.responseText

Set xml = Nothing
%>

xmlhttp 获得文件的时候是需要对中文重新处理一次的,有一个编写的函数

Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function

getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")