I have extensive records containing dialog edited using CKEditor. It translates father's to father’s and this is how it is stored in the table.
I am pulling the records to make a web page - hundreds of them at a time. I process several text fields (nsvarchar) such as:
<cfset a = '<blockquote class="dkpurplefont"><i>Notes for birth: </i>' & #GetData.BirthNotes# & '</blockquote>'>
<cffile action="append" file="#fname#" output="#a#" addnewline="yes">
I was using <cfset a = '<blockquote class="dkpurplefont"><i>Notes for birth: </i> #GetData.BirthNotes#</blockquote>'> which should work. I switched it thinking I might solve the issue.
60% of the time I will see "father's" on the completed web page. 40% of the time I see "father?s"
I infer that the engine is choking on the ’ as it processes #GetData.BirthNotes# and I'm guessing it is a speed issue - it is being processed faster that it can interpret. I can't find a way to correct it because, by the time I have access to the data, the errant ? has already been inserted (along with other ? that should be there).
Just before appending to file, apply:
<cfset a=replaceNoCase(a, "’", "'", "all")>
<cfset a=replaceNoCase(a, "‘", "'", "all")>
Thanks. Tried that. It seems that the erroneous ? (i.e., fails to
recognize ’) is inserted as a is first set. By the time I can
address the value of a it's too late.
You could do something like
<cfset a=REReplaceNoCase("<blockquote class=""dkpurplefont""><i>Notes for birth: </i>#GetData.BirthNotes#</blockquote>", "‘|’", "'", "all")>
I'll try that but it will be a couple of days.
If you use canonicalize() prior to inserting the data into the database or adding it to a file, this will remove all HTML entities and set them back to their original value (ie, "’" will be an apostrophe.) Be sure to set both flags to "false", otherwise multiple encoded or nested encoded strings will trigger an error.
^ _ ^