在ASP采集程序中,会用到的一个ASP函数,将获取到的网页源码转换为中文,为方便使用,我们写成一个函数BytesToBstr(Body,Cset),Body参数是要转换的变量,也就是采集到的内容,Cset 参数是要转换的类型,函数代码如下:
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
BytesToBstr(内容,编码)吉公网安备 22020202000301号