# URLDecode

Decodes a URL-encoded string.

See also URLEncodedFormat.

### Syntax

    URLDecode(urlEncodedString)

##### urlEncodedString

A string that has been URL-encoded.

### Usage

URL encoding refers to a data format where all high ASCII and non-alphanumeric characters are encoded using a percent sign followed by the two character hexadecimal representation of the character code. For example, a character with code 129 will be encoded as %81. In addition, spaces can be encoded using the plus sign (+).

Query strings in HTTP are always URL-encoded.

URL-encoded strings can be created using the URLEncodedFormat function.

### Example

Here is an example of the URLDecode and URLEncodedFormat functions. In the example, a string containing all ASCII character codes in the range 1-255 is created. The string is then encoded and decoded. The decoded value is compared with the original string to demonstrate their equality.

    <CFSCRIPT>
        // Build string
        s = "";
        for (c = 1; c lte 256; c = c + 1)
        {
            s = s & chr(c);
        }

        // Encode string and display result
        enc = URLEncodedFormat(s);
        writeOutput("Encoded string is: '#enc#'.<BR>");

        // Decode and compare result with original
        dec = URLDecode(enc);
        if (dec neq s)
        {
            writeOutput("Decoded is not the same as encoded.");
        }
        else
        {
            writeOutput("All's well on the Western front.");
        }
    </CFSCRIPT>