XHTML output for a single line of text is not encoded correctly

Last post 09-23-2011, 7:38 AM by Kenneth. 4 replies.
Sort Posts: Previous Next
  •  09-06-2011, 4:10 PM 69968

    XHTML output for a single line of text is not encoded correctly

    I am able to reproduce this issue on the XHTML demo site: http://cutesoft.net/example/xmloutput.aspx
     
    On that page, supply this single line of text in the text entry box:
     
    This & That
     

     Then click Submit. The produced output is:

    <div>This &amp;amp; That</div>
     
    Note that the text is incorrectly encoded, in that it has an extra "amp" that shouldn't be there.
     
    Now, put the cursor back in the text entry box, at the end of the line of text. Press Enter to supply a carriage return. Click Submit again. The output for that is:
     
    <div>This &amp; That</div><div>&nbsp;</div>
     
    Note that the ampersand between "This" and "That" is now correctly encoded. I've tested this is both Chrome and IE9, and experienced the same behavior.
     
    Is this a bug? Can it be fixed? Is there a workaround?
     
    Thanks. 
    Filed under: , ,
  •  09-07-2011, 7:34 AM 69976 in reply to 69968

    Re: XHTML output for a single line of text is not encoded correctly

    Hi moskie,
     
    Please try the example below
     
    <%@ Page Language="C#" ValidateRequest="False" %>

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <html>
    <head>
        <title>ASP.NET WYSIWYG Editor - Support output well-formed HTML and XHTML</title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <CE:Editor ID="Editor1" runat="server">
            </CE:Editor>
            <br />
            <asp:Button ID="btnUpdate" OnClick="Submit" runat="server" Text="Submit"></asp:Button><br />
            <asp:TextBox ID="textbox1" runat="server" TextMode="MultiLine" Height="250px" Width="770px"></asp:TextBox>
        </form>
    </body>
    </html>

    <script runat="server">
        void Page_Load(object sender, System.EventArgs e)
        {
            if (IsPostBack)
            {
                textbox1.Text = Editor1.XHTML;
            }
            else
            {
                Editor1.Text = "test content";
            }

        }
        public void Submit(object sender, System.EventArgs e)
        {
            textbox1.Text = Editor1.XHTML;
        }
    </script>

       <script type="text/javascript">      
       function CuteEditor_FilterHTML(editor,code)   
       {   
          return code.split("&amp;").join("&");
       }   
       function CuteEditor_FilterCode(editor,code)   
       {   
          return code.split("&amp;").join("&");
       }   
      </script> 
     
    Regards,
     
    Ken
  •  09-09-2011, 6:49 PM 70004 in reply to 69976

    Re: XHTML output for a single line of text is not encoded correctly

    EDIT: question retracted...
  •  09-22-2011, 7:28 PM 70160 in reply to 69976

    Re: XHTML output for a single line of text is not encoded correctly

    We're in the process of testing whether this solution resolves the issues reported by our clients.
     
    Is there any plan to include an official fix for this issue in future releases? 
  •  09-23-2011, 7:38 AM 70174 in reply to 70160

    Re: XHTML output for a single line of text is not encoded correctly

    Hi moskie,
     
    This issue has been fixed, please download the latest version and try again.
     
    latest version downloads http://www.cutesoft.net/downloads/folders/21904/download.aspx
     
    Online demo test http://cutesoft.net/example/xmloutput.aspx
     
    Regards,
     
    Ken
View as RSS news feed in XML