Chapter 2: ColdFusion Functions
URLDecode
Decodes a URL-encoded string.
See also URLEncodedFormat.
85/'HFRGHXUO(QFRGHG6WULQJ
Syntax
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)
{
}
// 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)
{
}
else
{
}
</CFSCRIPT>
s = s & chr(c);
writeOutput("Decoded is not the same as encoded.");
writeOutput("All's well on the Western front.");
551
Need help?
Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?