responseBody 后

于娜 于娜 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在xmlhttp.responseBody 后,需要用下面VB函数才能吧gb2312编码的网页内容,转换成utf-8编码,并且正常显示。

现在问题是我 要读取的网页已经是utf-8的了。用responseBody 获取后,我只要想吧responseBody这个流 解码成 UTF-字符串不安就行了,不用解码成GB2312 ,怎么做呢??


<script language="vbscript">
function bytes2bstr(vin)
Dim strReturn,i,ThisCharCode,innerCode,Hight8,Low8,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function

</script>
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
于娜
.NET社区 62,274 成员 668,968 内容