Returns 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.
URLEncodedFormat(string)
String being URL encoded.
<!--- 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>