URLEncode opposite (URLDecode)
The function Server.URLEncode converts a inputstring to an URL encoded outputstring. For example: input: Server.URLEncode("part1?part2") output: "part1%3Fpart2" But what if you need the opposite functionality ? There is no function available for this so you have build this yourself. How ? By using regular expressions, of course.
AI
AI-sammanfattning: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Källkod
Function URLDecode(sText)
sDecoded = sText
Set oRegExpr = Server.CreateObject("VBScript.RegExp")
oRegExpr.Pattern = "%[0-9,A-F]{2}"
oRegExpr.Global = True
Set oMatchCollection = oRegExpr.Execute(sText)
For Each oMatch In oMatchCollection
sDecoded = Replace(sDecoded,oMatch.value,Chr(CInt("&H" & Right(oMatch.Value,2))))
Next
URLDecode = sDecoded
End Function
Originalkommentarer (3)
Återställd från Wayback Machine