<script language=VBScript> function getHTTPPage(url) dim Http set http=createobject("Microsoft.XMLHTTP") Http.open "GET",url,false Http.send() if Http.readystate<>4 then exit function end if getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312") set http=nothing if err.number<>0 then err.Clear end function Function BytesToBstr(body,Cset) dim objstream set objstream = 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 Dim Url,Html Url="http://www.seasky.biz/" Html = getHTTPPage(Url) document.write(Html) </script>
一、自己写编码转换函数
二、用 ADODB.STREAM 转换
帮忙帖一下吧
我这只有vbs的
function getHTTPPage(url)
dim Http
set http=createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
end function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = 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
Dim Url,Html
Url="http://www.seasky.biz/"
Html = getHTTPPage(Url)
document.write(Html)
</script>
将返回的XML数据的第一行写成:<?xml version="1.0" encoding="gb2312" ?>你试试看,如果可以就加分!
2.可以用楼上的方法,返回XML数据,加入<?xml version='1.0' encoding='gb2312'?>