VB问题,将UTF-8转成汉字
我获取的网页源代码是乱码,后来我发现是UTF-8码来的。谁有做好的模板可直接转换成汉字的。帮我一下!...
我获取的网页源代码是乱码,后来我发现是UTF-8码来的。谁有做好的模板可直接转换成汉字的。帮我一下!
展开
1个回答
展开全部
BytesToBstr(utf-8编码,"utf-8")
'远程获取网页编码格式转换
Function BytesToBstr(body, charset)
Dim objstream
Set objstream = CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode = 3
objstream.Open
On Error Resume Next
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.charset = charset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function
'远程获取网页编码格式转换
Function BytesToBstr(body, charset)
Dim objstream
Set objstream = CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode = 3
objstream.Open
On Error Resume Next
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.charset = charset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询