5 Replies Latest reply on Dec 1, 2006 10:52 AM by GiambattistaScivoletto

    Problem with "replace"

    GiambattistaScivoletto Level 1
      I use this code to replace characters in a TEXT.

      <!--- escape TEXT --->
      <CFSET t1 = Replace("#text#","&","&amp;","ALL")>
      <CFSET t2 = Replace("#t1#","'","&apos;","ALL")>
      <CFSET t3 = Replace("#t2#","""","&quot;","ALL")>
      <CFSET t4 = Replace("#t3#","<","&lt;","ALL")>
      <CFSET t5 = Replace("#t4#",">","&gt;","ALL")>
      <CFSET t6 = Replace("#t5#","‘","&apos;","ALL")>
      <CFSET t7 = Replace("#t6#","’","&apos;","ALL")>
      <CFSET t8 = Replace("#t7#","“","&quot;","ALL")>
      <CFSET t9 = Replace("#t8#","”","&quot;","ALL")>
      <cfset e_text = "#t9#">

      It work with all characters but not with the following: ‘ ’ “ ”

      <CFSET t6 = Replace("#t5#","‘","&apos;","ALL")>
      <CFSET t7 = Replace("#t6#","’","&apos;","ALL")>
      <CFSET t8 = Replace("#t7#","“","&quot;","ALL")>
      <CFSET t9 = Replace("#t8#","”","&quot;","ALL")>

      The ones that usually use WORD. I tried also to put chr(X) instead of the characters but doesn't work either.

      Any suggestion ?