There came a scenario, where in the query string which carried the address of the users to another application had a # sign, which broke the system. Pound sign(#), having a special meaning in coldfusion, I had pretty tough time solving it. The solution is just simple.
eg If the address goes like this
<cfset var address1 = #447, North Avenue />(Probably this is coming from the database)
Doubling the hash would work if it's displayed in the cfm, wrapped in <cfoutput></cfoutput>. In this case I had to use this
<cfset queryString = queryString & Replace(address1,"##","CHR(35)","all") />
eg If the address goes like this
<cfset var address1 = #447, North Avenue />(Probably this is coming from the database)
Doubling the hash would work if it's displayed in the cfm, wrapped in <cfoutput></cfoutput>. In this case I had to use this
<cfset queryString = queryString & Replace(address1,"##","CHR(35)","all") />
- ## - Here pound sign is escaped by doubling it.
- CHR(35) is the ASCII equivalent of pound(#) sign.
No comments:
Post a Comment