552
CFML Language Reference
URLEncodedFormat
Returns a URL-encoded string. Spaces are replaced with + and all non-alphanumeric
characters with equivalent hexadecimal escape sequences. This function enables you
to pass arbitrary strings within a URL, because ColdFusion automatically decodes all
URL parameters that are passed to the template.
See also
URLDecode
.
Syntax
URLEncodedFormat
(
string)
string
String being 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.
Examples
<!--- This example shows URLEncodedFormat --->
<HTML>
<HEAD>
<TITLE>
URLEncodedFormat Example
</TITLE>
</HEAD>
<BODY BGCOLOR=silver>
<H3>URLEncodedFormat Example</H3>
<CFIF IsDefined("url.myExample")>
<P>The url variable url.myExample has been passed from the
previous link ... its value is:
<BR>"<CFOUTPUT>#url.myExample#</CFOUTPUT>"
</CFIF>
<P>This function returns a URL encoded string, making it
safe to pass strings through a URL.
<CFSET s =
"My url-encoded string has special characters & other stuff">
<P>
<A HREF=
"urlencodedformat.cfm?myExample=<CFOUTPUT>#URLEncodedFormat(s)#
</CFOUTPUT>">Click me</A>
</BODY>
</HTML>
Summary of Contents for COLDFUSION 4.5-CFML LANGUAGE
Page 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Page 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Page 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Page 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Page 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Page 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Page 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Page 584: ...560 CFMLLanguageReference...
Page 594: ...570 CFMLLanguageReference...