url编码 就是把url使用下边函数编码 Public Function URLencode(vstrin) Dim i, strreturn, strSpecial, t strSpecial = " <>""#%{}|^~[]`'&?+" & Chr(13) & Chr(10) strreturn = "" For i = 1 To Len(vstrin) thischr = Mid(vstrin, i, 1) If Abs(Asc(thischr)) < &HFF Then If InStr(strSpecial, thischr) > 0 Then If thischr = " " Then strreturn = strreturn & "+" Else t = hex(Asc(thischr)) If Len(t) = 1 Then t = "0" & t strreturn = strreturn & "%" & t End If Else strreturn = strreturn & thischr End If 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 URLencode = strreturn End Function
就是把url使用下边函数编码
Public Function URLencode(vstrin)
Dim i, strreturn, strSpecial, t
strSpecial = " <>""#%{}|^~[]`'&?+" & Chr(13) & Chr(10)
strreturn = ""
For i = 1 To Len(vstrin)
thischr = Mid(vstrin, i, 1)
If Abs(Asc(thischr)) < &HFF Then
If InStr(strSpecial, thischr) > 0 Then
If thischr = " " Then
strreturn = strreturn & "+"
Else
t = hex(Asc(thischr))
If Len(t) = 1 Then t = "0" & t strreturn = strreturn & "%" & t
End If
Else
strreturn = strreturn & thischr
End If
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
URLencode = strreturn
End Function