asp实现二进制字符串转换为Unicode字符串
(编辑:jimmy 日期: 2024/11/16 浏览:3 次 )
若需要utf-8格式,请自行将下面的GB2312改成utf-8。
' 二进制转字符串,否则会出现乱码的!
Function sTb(vin)
Const adTypeText = 2
Dim BytesStream,StringReturn
Set BytesStream = Server.CreateObject("ADODB.Stream")
With BytesStream
.Type = adTypeText
.Open
.WriteText vin
.Position = 0
.Charset = "GB2312"
.Position = 2
StringReturn = .ReadText
.Close
End With
Set BytesStream = Nothing
sTb = StringReturn
End Function
' 二进制转字符串,否则会出现乱码的!
Function sTb(vin)
Const adTypeText = 2
Dim BytesStream,StringReturn
Set BytesStream = Server.CreateObject("ADODB.Stream")
With BytesStream
.Type = adTypeText
.Open
.WriteText vin
.Position = 0
.Charset = "GB2312"
.Position = 2
StringReturn = .ReadText
.Close
End With
Set BytesStream = Nothing
sTb = StringReturn
End Function
下一篇:解决采集时出现msxml3.dll 错误的方法