URL_DECODE

The function URL_DECODE takes a String and returns a new string by unescaping any URL Percent Encoded characters.

This function takes a String and parses any Percent Encoded characters in the string.

Declaration

URL_DECODE(url) -> decoded_url

Parameters

url (type: string)

The URL to decode.

Return Values

decoded_url (type: string)

The decoded URL

Examples

A google search URL contains the search query in a URL parameter. For example, to search for the string "date/time", the URL is "https://www.google.com/search?q=date%2Ftime". Note that the slash is replaced by the percent-encoding "%2F". The URL_DECODE function can be used to convert such characters back into the original character that they represent.

URL_DECODE("https://www.google.com/search?q=date%2Ftime") ->  
"https://www.google.com/search?q=date/time"

Discussion

The function URL_ENCODE performs the opposite operation. It will replace any characters that have a special meaning in a URL and replace those characters with the appropriate percent-encoding. Encoding a string, and then decoding the result will return the original string.

URL_DECODE(URL_ENCODE("date/time")) -> "date/time"

Note, however, that the URL_ENCODE function can also take numbers and booleans, in this case encoding and then decoding the value will not produce the original value, but rather a string representing the original value.

URL_DECODE(URL_ENCODE(0)) -> "0"  
URL_DECODE(URL_ENCODE(true)) -> "true"

Last updated