View comments | RSS feed

URLDecode

Description

Decodes a URL-encoded string.

Return value

A copy of a string, decoded.

Category

Conversion functions, Other functions, String functions

Syntax

URLDecode(urlEncodedString[, charset])

See also

URLEncodedFormat

History

New in ColdFusion MX: ColdFusion supports the Java UCS-2 representation of Unicode character values 0-65535. (Earlier releases supported ASCII values.)

New in ColdFusion MX: the charset parameter is new.

Parameters

Parameter Description
urlEncodedString
URL-encoded string or a variable that contains one.
charset
A Java character set name. Optional.
The following values are typically used:
  • UTF-8
  • ISO-8859-1
  • UTF-16
  • US-ASCII
  • UTF-16BE
  • UTF-16LE
For a list of character sets, see:
http://www.w3.org/International/O-charset-lang.html

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>

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6

Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.

Comments


SoftIDEA said on Mar 12, 2004 at 4:16 PM :
I'd like to know if it does support the oriental and lrft-to-right charsets.
halL said on Mar 15, 2004 at 7:52 AM :
ColdFusion MX should handle any charset that Java can handle (that is, any character set that Java can convert to UCS-2, its internal character code), including most right-to-left and Asian character sets.

ColdFusion MX locale support (for example, currency format in the LSxxx functions) is more limited and does not include any of the right-to-left locales, but does include Chinese, Japanese, and Korean locales.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt2111.htm