Highlighted

replace quotes?

New Here ,
Nov 26, 2014

Copy link to clipboard

Copied

Hello I'm on Coldfusion 10 and I'm trying to figure out how to replace quotes ("). So far I tried this:

<cfset Session.Artist1 = Replace(Session.Artist1,"&quot;","&quot;",'ALL') >

That does nothing, I then tried this:

<cfset Session.Artist1 = Replace(Session.Artist1,"&#34","&quot;",'ALL') >

That errors out CF. I'll get this:

Error Occurred While Processing Request

Invalid construct: Either argument or name is missing.

So is there anything that would work in CF and in SQL for " (quotes)? I having people use the HTML &quot;, but that also shows up in SQL as the coding. I would like it to work in CF and in SQL as just ", but can't figure out how. Any help would be great.

Thanks

Views

741

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

replace quotes?

New Here ,
Nov 26, 2014

Copy link to clipboard

Copied

Hello I'm on Coldfusion 10 and I'm trying to figure out how to replace quotes ("). So far I tried this:

<cfset Session.Artist1 = Replace(Session.Artist1,"&quot;","&quot;",'ALL') >

That does nothing, I then tried this:

<cfset Session.Artist1 = Replace(Session.Artist1,"&#34","&quot;",'ALL') >

That errors out CF. I'll get this:

Error Occurred While Processing Request

Invalid construct: Either argument or name is missing.

So is there anything that would work in CF and in SQL for " (quotes)? I having people use the HTML &quot;, but that also shows up in SQL as the coding. I would like it to work in CF and in SQL as just ", but can't figure out how. Any help would be great.

Thanks

Views

742

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 26, 2014 0
Adobe Community Professional ,
Nov 26, 2014

Copy link to clipboard

Copied

Chr(34) is neat for the double quote. So try

<cfset Session.Artist1 = Replace(Session.Artist1, chr(34), "&quot;", "all") >

You could also be creative with single quotes, like this

<cfset Session.Artist1 = Replace(Session.Artist1, '"', '&quot;', 'all') >

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 26, 2014 0
New Here ,
Nov 26, 2014

Copy link to clipboard

Copied

I tried this and it doesn't do anything:

<cfset Session.Artist1 = Replace(Session.Artist1 , Chr(34),"&quot;",'ALL') >

What is happening is you can search for 'the "thing"' after you hit return CF will change it to 'the'. So it will ignore any characters after the ".

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 26, 2014 0
BKBK LATEST
Adobe Community Professional ,
Nov 27, 2014

Copy link to clipboard

Copied

I get no such complication. When I run the code

<cfset str='the "thing"'>

<cfset newStr = replace(str, chr(34),"&quot;","all")>

<cfoutput>#newStr#</cfoutput>

I get the result

the &quot;thing&quot;

Remember to view the result in the browser's source page.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 27, 2014 0