URLDECODE  
Description

Decodes a URL-encoded string.

 
Returns

A copy of a string, decoded.

 
Category

Conversion functions, Other functions, String functions

 
Function syntax
URLDecode(urlEncodedString[, charset])
 
See also

URLEncodedFormat; "Tags and functions for globalizing" in Chapter 17, "Developing Globalized Applications," in ColdFusion MX Developer's Guide

ColdFusion MX 6.1: Changed the default charset: the default charset is the character encoding of the URL scope.

ColdFusion MX:

  • Changed Unicode support: ColdFusion supports the Java UCS-2 representation of Unicode character values 0-65535. (Earlier releases supported ASCII values.)
  • Added the charset parameter.
 
Parameters

 
Usage

URL encoding formats some characters with a percent sign and the two-character hexadecimal representation of the character. For example, a character whose code is 129 is encoded as %81. A space is encoded with a plus sign.

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>

URL-encoded string or a variable that contains one.

URLENCODEDSTRING  

The character encoding in which the URL is encoded. Optional.

The following list includes commonly used values:

For more information on character encoding, see:www.w3.org/International/O-charset.html.

The default value is the character encoding of the URL scope. See SetEncoding.

CHARSET