Skip to main content
Inspiring
December 7, 2010
Question

fckeditor and apostrophes

  • December 7, 2010
  • 2 replies
  • 970 views

I've got a system where a user uploads an html file, and then the contents of the file is extracted using an xmlparse:

<cfscript>

    myxmldoc1 = XmlParse("D:\inetpub\mywebsite\editorial\#whichsection#\#Uploaded_Folder_Name#\#htmlFileName#");

    selectedElements = XmlSearch(GetTheTitle, "/html/body/h1");

    s = "";

    for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)

        s &= selectedElements.XmlText;

</cfscript>

The result of the xmlparse is shown in the FCKeditor. Works just fine, except my apostrophes aren't showing up. In the original html file, apostrophes are represented as "&rsquo;"

I know right after the parse I can do a Replace or REreplace, but I tried that and it made absolutely no difference. Any ideas?

    This topic has been closed for replies.

    2 replies

    Inspiring
    December 7, 2010

    Do the replace before the parse.

    Squiggy2Author
    Inspiring
    December 7, 2010

    Thanks Dan. Makes total sense, but my implementation must be wrong:

    <cfscript>

        myxmldoc1 = XmlParse("D:\mywebsite\editorial\#whichsection#\#Uploaded_Folder_Name#\#htmlFileName#");

        selectedElements = XmlSearch(GetTheTitle, "/html/body/h1");

        s = "";

        for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)

            s &= selectedElements.XmlText;

    </cfscript>

    <cfset cleanedupapost = Replace(myxmldoc1, "&rsquo;", "'", "ALL")>

    Then I use the cleanedupapost variable to fill the text editor. Works, but the apostrophes still don't show up.

    Squiggy2Author
    Inspiring
    December 7, 2010

    OK, now I see that while the original html file has apostrophes in it (using "&rsquo;"), even if I don't apply any Replace code, the apostrophe's don't show up. It looks like the xmlparsing is taking it out automatically. Is that normal?

    December 7, 2010

    Plz try ...

    <cfset basePath = "fckeditor/">


    <cfset testString="This is a test name


            & d&lsquo;zouza ">


    <cfscript>



    fckEditor = createObject("component", "#basePath#fckeditor");


    fckEditor.instanceName = "myEditor";


    fckEditor.value   = '#testString#';


    fckEditor.basePath  = basePath;


    fckEditor.width   = "100%";


    fckEditor.height  = 450;



    fckEditor.create(); // create the editor.


    </cfscript>