VB代码<%
'第一个函数
Function bytes2BSTR(vIn) 
dim strReturn 
dim i,ThisCharCode,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 '第二个函数
Function Unicode2Chr(byval str)
 Dim st, t, i
 For i = 1 To Len(str)/4
  t = Mid(str, 4*i-3, 4)
  't = Mid(t, 3) & Left(t, 2)
  t = ChrW(Hex2Dec(t))
  st = st & t  
 Next
 Unicode2Chr = st
End Function'第三个函数
Function Hex2Dec(byval str)
 Dim i, j, k, result
 result = 0
 For i = 1 To Len(str)   
  Select Case Mid(str, i, 1)
   Case "f":  j = 15   
   Case "e":  j = 14  
   Case "d":  j = 13
   Case "c":  j = 12    
   Case "b":  j = 11    
   Case "a":  j = 10 
   Case Else: If Mid(str, i, 1) <= "9" And Mid(str, i, 1) >= "0" Then j = CInt(Mid(str, i, 1)) 
  End Select
  
  For k = 1 To Len(str) - i
   j = j * 16
  Next
  result = result + j
 Next
 Hex2Dec = result
End Function'第四个函数
Function Chr2Unicode(byval str)
Dim st, t, i,t1
For i = 1 To Len(str)
t = Hex(AscW(Mid(str, i, 1)))
If (Len(t) < 4) Then
while (Len(t) < 4)
t = "0"&t 
Wend
End If
t = Mid(t, 3) & Left(t, 2)
        t1=mid(t,3,2)&mid(t,1,2)
st = st & t1
Next
Chr2Unicode = LCase(st)
End Function
%>