i'am trying to pass a URL "encodedFormat" string to another page.
I'am having trouble to pass symbols like # otherwise everything else seem to work.
The url variable passed is : #URL.var11# </cfoutput>
if i put var1="abc12#", this will gimme an error ...
problem happens with "#" symbol ...
Since the # symbol is a special character in coldfusion, you need to escape it in a string. Try "abc12##" instead.
Originally Posted by korssane
Thanks, but how if i'am passing a text field value and the user has entered a # sign in the text field ??..how can i double the # sign then..
You shouldn't need to. This is only an issue when you are typing string literals with the '#' symbol into ColdFusion code. Putting in a
<cfset something = "hi##"> will produce the literal string "hi#", which is then set to the variable
something. In this case, the double hash symbol (##) in ColdFusion code escapes into a single hash symbol (#).
However, whatever someone types into a textfield will not be parsed and processed by ColdFusion. They could type this into a textfield: "oogly #boogly#", and they will get the literal string "oogly #boogly#". However, if you put that in CF code as the value for say, a <cfset> (such as with
<cfset something = "oogly #boogly#">), then you would get an error message: "variable 'boogly' is not defined".