Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Escaping single quotes

Status
Not open for further replies.

chebbi

Programmer
Joined
Feb 6, 2002
Messages
98
Location
IN
Hi Guys

I need the cf function to escape single quotes in my string. I used htmleditformat but that didnt help.

Iam pasting simple two line code for you guys which i used

<cfset test=&quot;test'test&quot;>
<cfoutput>
#HTMLEditFormat(test)#
</cfoutput> Badrinath Chebbi
 
PreserveSingleQuotes(variable)
Sylvano
dsylvano@hotmail.com
 
#Replace(string,&quot;'&quot;,&quot;\'&quot;,&quot;ALL&quot;)# hope that helps
 
Replace(string, &quot;''&quot;, &quot;&squo;&quot;, &quot;all&quot;)

ascii for single quote is 39 so you can try this also:

Replace(string, &quot;#Chr(39)#&quot;, &quot;&squo;&quot;, &quot;all&quot;)

you can also try to escape it with &rsquo; or &lsquo; (left ot right single quote); Sylvano
dsylvano@hotmail.com
 
one more thing, while HTMLEditFormat() escapes <>&quot;& characters, XMLFormat() will escape <>&quot;& and ' characters so I guess you can try this one too.

:) Sylvano
dsylvano@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top