function strToHex(str) dim i, char, hexValue for i=1 to len(str) char = hex(asc(mid(str, i, 1))) if len(char) = 1 then : char = "0" & char : end if hexValue = hexValue & char next strToHex = hexValue end function function hexTostr(hexStr) dim i, char, hexValue for i=1 to len(hexStr) step 2 char = mid(hexStr, i, 2) if char > "80" then i = i+2 char = char & mid(hexStr, i, 2) end if Execute "char = &H" & char hexValue = hexValue & chr(char) next HexTostr = hexValue end function function URLEncoding(vstrIn) strReturn = "" For i = 1 To Len(vstrIn) ThisChr = Mid(vStrIn,i,1) If Abs(Asc(ThisChr)) < &HFF Then strReturn = strReturn & ThisChr Else innerCode = Asc(ThisChr) If innerCode < 0 Then innerCode = innerCode + &H10000 End If Hight8 = (innerCode And &HFF00)\ &HFF Low8 = innerCode And &HFF strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8) End If Next URLEncoding = strReturn end function function bytes2BSTR(vIn) 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