Line-feed/Carriage return entities inserted when Source edited

Last post 10-08-2013, 4:53 AM by Justinian. 2 replies.
Sort Posts: Previous Next
  •  09-30-2013, 7:06 AM 78034

    Line-feed/Carriage return entities inserted when Source edited

    Hi,

     

    Hoping someone can help with this as it's been bothering me for awhile now.

     

    I have RTE saving content to an MSSQL DB. I do this by using the Editor.Text property, and save that to an NVARCHAR field.

     

    Everything is working fine, except whenever the HTML is edited in anyway via the 'Source' view, the HTML is saved with 
 between each line of code. Screen grab here: http://imageshack.us/photo/my-images/713/5kby.png/

     

    This results in massive spacing problems in 'Design' view and compounds each time the HTML source is edited and saved. It also makes the HTML a nightmare to edit after awhile.

     

    This only happens if the HTML is edited via the 'Source' button. Edits in 'Design' view don't cause this.

     

    I'm hoping this is simply a setting somewhere that I've missed - but I've been unable to find any references to it or others experiencing similar problems.

  •  10-07-2013, 8:36 AM 78062 in reply to 78034

    Re: Line-feed/Carriage return entities inserted when Source edited

    Hi Justinian,

     

    Does the  
 generated before save? Or after saved into database?

     

    Can you try the example below? try edit some content in source view and click on the save button to save the content into the textbox, does it gets the same problem?

     

    1. <%@ Page Language="c#" ValidateRequest="false" %>  
    2.   
    3. <%@ Register TagPrefix="RTE" Namespace="RTE" Assembly="RichTextEditor" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5. <script runat="server">  
    6.   
    7.     protected void btn_save_Click(object sender, EventArgs e)  
    8.     {  
    9.         tb_content.Text = editor1.Text;  
    10.     }  
    11. </script>  
    12.   
    13. <html xmlns="http://www.w3.org/1999/xhtml">  
    14. <head>  
    15.     <title>example</title>  
    16.   
    17. </head>  
    18.   
    19. <body>  
    20.     <form id="Form1" method="post" runat="server">  
    21.         <RTE:Editor ID="editor1" runat="server" />  
    22.         <asp:Button ID="btn_save" runat="server" Text="save" OnClick="btn_save_Click" /><br />  
    23.         <asp:TextBox ID="tb_content" runat="server" TextMode="MultiLine" Rows="10" Width="600px"></asp:TextBox>  
    24.     </form>  
    25. </body>  
    26. </html>  
     

    Regards,

     

    Ken 

  •  10-08-2013, 4:53 AM 78068 in reply to 78062

    Re: Line-feed/Carriage return entities inserted when Source edited

    Hi Ken,


    Thanks very much for the response. Yes - the carriage returns are still inserted.

     

    However, this gave me an idea and after much fiddling, I seem to have discovered the source of the problem. I have MS AntiXssEncoder set as my encoder type in web.config. When this is removed, the problem is resolved. 

     

    So I won't be using that particular library anymore!

     

    Once again, many thanks for the response.

View as RSS news feed in XML