This is a migrated thread and some comments may be shown as answers.

RadEditor for moss have a problem in handle special characters

2 Answers 81 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
gao
Top achievements
Rank 1
gao asked on 28 Apr 2008, 07:06 AM
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 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 29 Apr 2008, 12:27 PM
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
0
gao
Top achievements
Rank 1
answered on 30 Apr 2008, 05:33 AM
Hi Rumen;
  Thanks very much! I have tested it and it works well!:)

Best regards
Gao Ye
Tags
WebParts for SharePoint
Asked by
gao
Top achievements
Rank 1
Answers by
Rumen
Telerik team
gao
Top achievements
Rank 1
Share this question
or