- <%Public Function URLEncoding(v,f)
- Dim s,t,i,j,h,l,x : s = "" : x=Len(v)
- For i = 1 To x
- t = Mid(v,i,1) : j = Asc(t)
- If (j>=48 And j<=57) Or (j>=65 And j<=90) Or (j>=97 And j<=122) Then
- If f Then
- s = s & "%" & Right("00" & Hex(j),2)
- Else
- s = s & t
- End If
- ElseIf j<0 Then
- j = j + &H10000
- h = (j And &HFF00) \ &HFF
- l = j And &HFF
- s = s & "%" & Right("00" & Hex(h),2) & "%" & Right("00" & Hex(l),2)
- Else
- s = s & "%" & Right("00" & Hex(j),2)
- End If
- Next
- URLEncoding = s
- End Function
- response.write URLEncoding("hezu123.com",1)
- %>