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>
Содержание COLDFUSION 4.5-CFML LANGUAGE
Страница 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Страница 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Страница 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Страница 296: ...272 CFMLLanguageReference INPUT TYPE text NAME number2 BR INPUT TYPE submit NAME submit VALUE Add FORM BODY HTML...
Страница 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Страница 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Страница 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Страница 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Страница 557: ...Chapter 2 ColdFusion Functions 533 P CFOUTPUT Value i is employee keysToStruct i CFOUTPUT P CFLOOP CFIF BODY HTML...
Страница 584: ...560 CFMLLanguageReference...
Страница 594: ...570 CFMLLanguageReference...