
Announcements
Function EncodeURL(ByVal str)
encodedStr = ""
For i = 1 To Len(str)
c = Mid(str, i, 1)
If c Like "[A-Za-z0-9-_.~]" Then
encodedStr = encodedStr & c
Else
encodedStr = encodedStr & "%%" & Hex(AscB(c))
End If
Next
EncodeURL = encodedStr
End Function
inputString = "abd def"
encodedString = EncodeURL(inputString)
WScript.Echo encodedString
Function EncodeURL(ByVal str)
Dim encodedStr, i, c
encodedStr = ""
allowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~"
For i = 1 To Len(str)
c = Mid(str, i, 1)
If InStr(allowedChars, c) > 0 Then
encodedStr = encodedStr & c
Else
encodedStr = encodedStr & "%%" & Hex(Asc(c)) ' Keep PAD's double %%
End If
Next
EncodeURL = encodedStr
End Function
inputString = "abd def"
encodedString = EncodeURL(inputString)
WScript.Echo encodedString
