User Guide
730 Chapter 3: ColdFusion Functions
Query strings in HTTP are always URL-encoded.
Example
This example creates, encodes, and decodes a string that contains ASCII character codes.
<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 quiet on the Western front.");
}
</cfscript>