Strange Characters When Trying To Strip Font Tags

2 posts, 0 answers
  1. David Gottlieb
    David Gottlieb avatar
    1 posts
    Member since:
    Jun 2004

    Posted 10 Aug 2007 Link to this post

    We have implemented the Sharepoint RadEditor control on our site and we are seeing some strange behavior when pasting from Microsoft Word.

    When we paste from Word and tell it Yes to remove all Word formatting, it seems to work fine. However, when we choose the Format Stripper and choose the Font Tags option to remove all Font Tags, the text that then appears seems to be something like Greek text or something. It looks normal when you view the HTML view but in design view, it looks like Greek text. The only way I know to get rid of that is to first strip all Span tags, then strip all Cascading Style Sheets. At that point I can strip all Font Tags and it works.

    I am copying from Word 2007. Could that be the issue? Is this a known thing?


  2. Rumen
    Rumen avatar
    12782 posts

    Posted 13 Aug 2007 Link to this post

    Hi David,

    Regarding my experience with pasting from Word, I know that the shape of the bulleted lists content is set by wrapping the symbol inside a Symbol font, which when pasted in RadEditor is not stripped and thus the content wrapped in Symbol font is displayed with Greek letters. I believe that in your scenario, the Word content pasted in RadEditor has Symbol font.

    Here is a sample code that will parse the MS Word content when pasted and will clean the Symbol fonts:

    <radE:RadEditor ID="RadEditor1" runat="server"></radE:RadEditor>
    <script type="text/javascript">
    var old = RadEditorNamespace.StripWordFormatting;
    RadEditorNamespace.StripWordFormatting = function(html, clearValue)
        var result = old(html, clearValue); 
        var fontCleaner = /(\<span style=\"[a-z\-\:\s0-9\;]*)(font-family\s*\:\s*Symbol)/ig; 
        var newContent = result.replace(fontCleaner,"$1"); 
        return newContent;

    I hope this helps.

    Best regards,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

Back to Top