Contents > CFML Reference > ColdFusion Functions > URLDecode PreviousNext

URLDecode

Decodes a URL-encoded string.

A copy of a string, decoded.

Conversion functions, Other functions, String functions

URLDecode(urlEncodedString[, charset])

URLEncodedFormat

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

ColdFusion MX:

Parameter

Description

urlEncodedString

URL-encoded string or a variable that contains one.

charset

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

The following list includes commonly used values:

  • utf-8
  • iso-8859-1
  • windows-1252
  • us-ascii
  • shift_jis
  • iso-2022-jp
  • euc-jp
  • euc-kr
  • big5
  • euc-cn
  • utf-16

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

Default: the character encoding of the URL scope. See SetEncoding.

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.

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>

Contents > CFML Reference > ColdFusion Functions > URLDecode PreviousNext

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

Version 6.1

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

 

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

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/funca113.htm