Having trouble remove "double quotes" (ASCII code 34)

<cfset string = “Magic points the way towards a world user identity and authentication is decentralized and not subject to control by the tech giants,”>

REreplace(string,'"#chr(10)##chr(13)#|“|”', '','all')
(Note, yes, among others, get rid of paragraph breaks as well)

I’m using NotePad ++ (encoding: UTF-8), copy/paste the double quotes " " to it, it looks different…

What could be wrong? Thanks.

Hi @justaguy, first: I don’t see any double quotes in your string. If you want to remove double straight quotes, you don’t need to use regex replacement. A simple replace() or replacenocase should do it. If the replacements are just a few ones, you can chain it. For more powerfull changes you still can use RegExpressions.

Second: be aware of the differences of your quotes, you are using "Straight quotes" chr(34) and “smart quotes” chr(147) and chr(148). To identify the codes, analyse it with a HEX editor and take a close look to all the data. Some editors like e.g. Word do a autocorrection of straight codes into smart codes while typing or copy pasting.

And last thing: in CFML you escape quotes with another quote:

<cfset string = "this is only one double quote escaped in cfml: "", and this is are two double quote escaped in cfml: """" and do it with another double quote here  """" then continue the text user identity and authentication is decentralized">

<Cfoutput>
This is a replacement of multiple double quotes:
#Replace(string,"""""","","all")#
</cfoutput>

And if you place code in this forum, please place it “as code”. This will help a little to distinguish exactly the characters you are using. Hope that clarifies a little.

1 Like

@justaguy As per @andreas comment pls put a test code as code type here. Here is the example to remove all “double quotes”

<cfset string = " #chr(34)##chr(34)##chr(34)##chr(34)#this is only one double #chr(34)# quote escaped in cfml: "", and this is are two double quote escaped in cfml: """" and do it with another double quote here  """" then continue the text user identity and #chr(34)# #chr(34)#authentication is decentralized """"""">
<cfoutput>#string#</cfoutput><br>
<Cfoutput>
#Replace(string,"""","","all")#
</cfoutput>
2 Likes

Thanks you @andreas and @cfmitrah the “smart quotes” solves it.

1 Like

I recently wrote a ColdFusion UDF to solve this problem as Microsoft 365 was returning different unicode smart quotes when I pasted from Word.

symbolsToASCII(required string inputString)

2 Likes

Thank you @Jamo