vba爬虫返回数据乱码处理
Function BytesToBstr(strBody, CodeBase) '使用Adodb.Stream对象提取字符串
Dim objStream
On Error Resume Next
Set objStream = CreateObject("Adodb.Stream")
With objStream
.Type = 1 '二进制
.Mode = 3 '读写
.Open
.Write strBody '二进制数组写入Adodb.Stream对象内部
.Position = 0 '位置起始为0
.Type = 2 '字符串
.Charset = CodeBase '数据的编码格式
BytesToBstr = .ReadText '得到字符串
End With
objStream.Close
Set objStream = Nothing
If Err.Number <> 0 Then BytesToBstr = ""
On Error GoTo 0
End Function
标签:vba,Stream,BytesToBstr,objStream,爬虫,乱码,Adodb
From: https://www.cnblogs.com/yiblue/p/16907799.html