RadEditor for moss have a problem in handle special characters

3 posts, 0 answers
  1. gao
    gao avatar
    2 posts
    Member since:
    Feb 2008

    Posted 28 Apr 2008 Link to this post

    Hi:
      I find the radeditor for moss have a problem with the special html characters, for example:
    "
      <html>
        <head>
            <title></title>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <meta content="Microsoft SafeHTML" name="Generator" />
        </head>
        <body>
            &amp;
        </body>
    </html>
    "
    in the radeditor's html mode textbox (use radeditor sharepoint for store page content) and check in or publish this page, the pagecontent's html code will change to
    "
    <html>
        <head>
            <title></title>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <meta content="Microsoft SafeHTML" name="Generator" />
        </head>
        <body>
            &amp;amp;
        </body>
    </html>
    "
    automaticly add "amp;" in this content, is anyone know why? thanks very much!
  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 29 Apr 2008 Link to this post

    Hi Gao,

    The observed issue is a browser behavior and can be reproduced with a similar web editors.

    Here is an example that demonstrates how to replaces on the client the ampersand entity with the ampersand representation by using a regular expression and a content filter
    in RadEditor for MOSS:

    1) Open the \Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\4.5.4.0__1f131a624888eeed\RadControls\Editor\ConfigFile.xml file and register the OnClientLoad event of RadEditor:

          <configuration>
            ...
              <property name="OnClientLoad">OnClientLoad</property>
          </configuration>

    2) Open the page with the <radE:RadHtmlField in Microsoft Office SharePoint Designer and put the following JavaScript inside the PlaceHolderAdditionalPageHead asp:content tag:

        <asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
      <script type="text/javascript">
      function RadEditorCustomFilter()
      {         
       this.GetHtmlContent = function (content)
       {    
        re = /&amp;/gi   
        newContent = content.replace(re, "&");
      

          return newContent;
       };       
      }
     
     /* Use the editor onload function to register the filter with the FiltersManager */
      function onClientLoad (editor)
      {
       var customFilter = new RadEditorCustomFilter();
       editor.FiltersManager.Add(customFilter);  
      }
     </script>
    <style>
    ...
    </style>

    3) Save the files and test the editor.


    Best regards,
    Rumen
    the Telerik team

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

  3. gao
    gao avatar
    2 posts
    Member since:
    Feb 2008

    Posted 30 Apr 2008 Link to this post

    Hi Rumen;
      Thanks very much! I have tested it and it works well!:)

    Best regards
    Gao Ye
Back to Top