最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp msxml.xmlhttp采集数据并解决乱码问题
时间:2022-06-30 09:24:04 编辑:袖梨 来源:一聚教程网
'在asp中要采集数据一般会利用了asp xmlhttp这个组件来实例了,很多时候采集过来的中文会是乱码,我们利用
bytestobstr函数转换解决了采集乱码的问题。
function gethttppage(url)
on error resume next
dim http
set http=server.createobject("msxml2.xmlhttp")
http.open "get",url,false
http.send()
if http.readystate4 then
exit function
end if
gethttppage=bytestobstr(http.responsebody,"utf-8")
set http=nothing
if err.number0 then
response.write "www.111com.net 服务器获取文件内容出错"
err.clear
end if
end function
'字节流转换为字符串
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
相关文章
- 免费视频提取软件合集 值得推荐的视频提取软件盘点 07-30
- 有哪些软件英语推荐 值得推荐的英语app盘点 07-30
- 日结临时工app哪个平台靠谱 真实可靠的日结临时工app推荐 07-30
- ai做ppt一键生成工具推荐 ai做ppt一键生成工具有哪些 07-30
- 学泰语的app哪个更好 学泰语的app实用分享 07-30
- 免费看韩国电影的app有哪些 实用韩国电影app精选 07-30