In your example, the answer should use both.
However, depending on the contents of FORM.path , you may break things.
The encodeForURL function should be called encodeUriComponent ( as done in Javascript ) because it is intended to be used on uri components, not the entire URL string. The uri component, such as name value pairs, must be encoded separately, otherwise the delimiter ("=" for value value pairs) will also be encoded.
The following will result in 404, even if you have an index.cfm file. Note that the path separator is "/", the query string separator is "?" and the name / value separator "=" is encoded, which makes the entire string a single unit.
<a href="#encodeForURL("/index.cfm?x=y")#">here</a>
What needs to be done is:
<cfset pathURIEncoded = "/index.cfm?#encodeForURL("x")#=#encodeForURL("y")#"> <a href="#encodeForHTMLAttribute(Variables.pathURIEncoded)#">here</a>
Replacing x and y with variables rather than static strings, of course.
source share