UTF-8 Unicode Ansi 汉字GB2321几种编码转换程序(2)
innerCode = innerCode + &H10000
End If
Hight8 = (innerCode And &HFF00) \ &HFF
Low8 = innerCode And &HFF
strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8)
End If
Next
AnsiCode = strReturn
End Function
Function DeCodeAnsi(s)
Dim i, sTmp, sResult, sTmp1
sResult = ""
For i=1 To Len(s)
If Mid(s,i,1)="%" Then
sTmp = "&H" & Mid(s,i+1,2)
If isNumeric(sTmp) Then
If CInt(sTmp)=0 Then
i = i + 2
ElseIf CInt(sTmp)>0 And CInt(sTmp)<128 Then
sResult = sResult & Chr(sTmp)
i = i + 2
Else
If Mid(s,i+3,1)="%" Then
sTmp1 = "&H" & Mid(s,i+4,2)
If isNumeric(sTmp1) Then
sResult = sResult & Chr(CInt(sTmp)*16*16 + CInt(sTmp1))
i = i + 5
End If
Else
sResult = sResult & Chr(sTmp)
i = i + 2
End If
内容版权声明:除非注明,否则皆为本站原创文章。