28,409
社区成员




Private Function GetStr()
Dim c
GetStr = ""
Do While (True)
c = AscB(Stream.Read(1))
If (c = 0) Then Exit Do
'如果是双字节,就进行高字节在结合低字节合成一个字符
If c > 127 Then
If Stream.EOS Then Exit Do
GetStr = GetStr & "%" & Hex(C) & "%" & Hex(AscB(Stream.Read(1))) ' <-- 修改后的内容
' GetStr = GetStr & Chr(AscW(ChrB(AscB(Stream.Read(1))) & ChrB(C))) ' <-- 修改前的内容
Else
GetStr = GetStr & Chr(c)
End If
Loop
End Function
<%
response.write C4Code(addr,"GB2312","UTF-8")
' 该方法未测试
' C4Code(vStr,FromCharset,ToCharset)
' 转换字符串编码
'
' #####################################################
'
' vStr 为原始字符串
' FromCharset 为原始编码
' ToCharset 为转换后编码
'
' #####################################################
'
Function C4Code(vStr,FromCharset,ToCharset)
Dim File
Set File = server.CreateObject("Adodb.Stream")
File.Charset = ToCharset
File.Mode = 3
File.Open
File.Type = 2
File.Position = 0
File.WriteText vStr
File.Position = 0
File.Charset = FromCharset
C4Code = File.ReadText
End Function
%>