Need help with plain text

Last post 04-07-2006, 4:39 PM by mhunter. 3 replies.
Sort Posts: Previous Next
  •  04-07-2006, 4:10 PM 18001

    Need help with plain text

    I am using the editor for the creation of a web based mail system.  When I set the plain text of my message to Editor1.PlainTextwithLineFeeds the text that comes through and is inserted into the message still is HTML encoded.  Any suggestions?
     
    Thanks again.
    Mark
     
  •  04-07-2006, 4:17 PM 18003 in reply to 18001

    Re: Need help with plain text

    Maybe this ASP function to strip HTML code would work.  It shouldn't be hard to convert:

    ' Function Strip All HTML Tags
    ' Author Abd Shomad:
    ' http://www.4guysfromrolla.com/webtech/abdshomad.shtml
    Function StripHTMLTag(ByVal sText)
        StripHTMLTag = ""
        fFound = False
        Do While InStr(sText, "<")
            fFound = True
            StripHTMLTag = StripHTMLTag & " " & Left(sText, InStr(sText, "<")-1)
            sText = MID(sText, InStr(sText, ">") + 1)
        Loop
        StripHTMLTag = StripHTMLTag & sText
        If Not fFound Then StripHTMLTag = sText
    End Function

    http://www.4guysfromrolla.com/webtech/100199-1.shtml

  •  04-07-2006, 4:29 PM 18004 in reply to 18003

    Re: Need help with plain text

    From your reply, I am guessing that this is not an inherent function of the editor.  If that is the case, I will have to implement some type of script, such as the one you have suggested.  Know of any versions in c#?
    Thanks again.
    Mark
     
     
  •  04-07-2006, 4:39 PM 18006 in reply to 18004

    Re: Need help with plain text

    Looks like I found the solution in c# as the following:

    string plainbody = Editor1.PlainTextWithLinefeeds + endtagtxt;

    string stripped = Regex.Replace(plainbody,@"<(.|\n)*?>",string.Empty);

    msg.PlainMessage.Body = stripped;
     
     
View as RSS news feed in XML