webdork
asked on
HTML Decode URL
I need to decode a string return. I can do the encode, not sure of the decode.
Like this, TOKEN value needs to be decode.
TOKEN=EC%2d388178183U92444 3N
Like this, TOKEN value needs to be decode.
TOKEN=EC%2d388178183U92444
ASKER
I see... I think.
How call function?
How call function?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks, works great.
@WebDork - just saw your link to this question from your other question.
Padas already provided the exact same function I was going to post.
Funny that I happened to be working on a page earlier this morning that is nearly identical to your quest. (Taking a URLEncoded value (a URL), decoding it and spitting it into the different parameters by splitting it on the "&" and then the "=" to get specific param values I am looking for.)
Padas already provided the exact same function I was going to post.
Funny that I happened to be working on a page earlier this morning that is nearly identical to your quest. (Taking a URLEncoded value (a URL), decoding it and spitting it into the different parameters by splitting it on the "&" and then the "=" to get specific param values I am looking for.)
' --------------------------
' URL decode to retrieve the original value
Function URLDecode(sConvert)
Dim aSplit
Dim sOutput
Dim I
If IsNull(sConvert) Then
URLDecode = ""
Exit Function
End If
' convert all pluses to spaces
sOutput = REPLACE(sConvert, "+", " ")
' next convert %hexdigits to the character
aSplit = Split(sOutput, "%")
If IsArray(aSplit) Then
sOutput = aSplit(0)
For I = 0 to UBound(aSplit) - 1
sOutput = sOutput & _
Chr("&H" & Left(aSplit(i + 1), 2)) &_
Right(aSplit(i + 1), Len(aSplit(i + 1)) - 2)
Next
End If
URLDecode = sOutput
End Function