Re: Plain text with line feeds issue

  •  04-10-2006, 4:02 AM

    Re: Plain text with line feeds issue

    Hi Adam,
     
    thanks for the reply. In the mean time, I've used the following to remove any extra html not wanted:

    string
    plainbody = Editor1.PlainTextWithLinefeeds;
    string stripped = plainbody.Replace("<br> &nbsp;", "<br>");
    stripped = stripped.Replace(
    " &nbsp;", "");
    stripped = stripped.Replace(
    "&nbsp; ", "");
    stripped = stripped.Replace(
    "&nbsp;", "");
    stripped = stripped.Replace(
    "<br> ", "<br>");
    stripped = stripped.Replace(
    "<p> ", "<br><br>");
    stripped = stripped.Replace(
    "<p>", "<br><br>");
    stripped = stripped.Replace(
    "<br>", "\r\n");
     
    I did some testing to see just what was returned using PlainTextWithLineFeeds and found that the above seems to get rid of all unwanted html and leave only '\r\n' for line feeds.
     
    Of course, when I load the body from the database, for editing in Cute, I need to replace all '\r\n' with '<br>' again so that is shows properly in Cute.
     
    Regards
    Gerardicus
View Complete Thread