XMLHTTP抓取数据时乱码问题解决

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 babyt 的 blog

csdn原帖:
http://community.csdn.net/expert/topic/3316/3316086.xml?temp=.2790033


内码问题.用这段代码的吧,我已经改得很精简了.
'使用xmlhttp抓取地址并进次内容处理
function getbody(url)
  dim objxml
        on error resume next
        set objxml = createobject("microsoft.xmlhttp")
        with objxml
        .open "get", url, false, "", ""
        .send
        getbody = .responsebody
        end with
        getbody=bytestobstr(getbody,"gb2312")
        set objxml = nothing
end function
'使用adodb.stream处理二进制数据
function bytestobstr(strbody,codebase)
        dim objstream
        set objstream = server.createobject("adodb.stream")
        objstream.type = 1
        objstream.mode =3
        objstream.open
        objstream.write strbody
        objstream.position = 0
        objstream.type = 2
        objstream.charset = codebase
        bytestobstr = objstream.readtext
        objstream.close
        set objstream = nothing
end function

本文关键:XMLHTTP抓取数据时乱码问题解决
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top