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

Rendering Symbols in Unicode

3 Answers 264 Views
Editor
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 18 Jun 2008, 01:13 PM
Hi All,
I'm working on a project, where we are required to export symbols as unicode text in the finished HTML from the rad editor.  For example, I want Г to be rendered as Г in the HTML.  I found an article that addressed this at the following location: 
http://www.telerik.com/support/kb/article/b454K-mtg-b454T-bgh-b454c-bgh.aspx.  However, the javascript fails at the following line:  

  function OnClientLoad(editor, args)  
    {  
       editor.get_FiltersManager().add(new RadEditorCustomFilter());  
    }  

It throws an error: 

Microsoft JScript runtime error: Object doesn't support this property or method

Is there an assembly reference for javascript properties that I am missing, or is there a javascript error somewhere?  Any help is appreciated, as this is very important to our project. 

Thanks,
John

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 18 Jun 2008, 02:05 PM
Hi John,

Please, replace the get_FiltersManager() with get_filtersManager() and the code will start to work. I will update the KB article right away.

All the best,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
John
Top achievements
Rank 1
answered on 18 Jun 2008, 02:27 PM
Hi Rumen,
Thanks very much for the quick response.  The code now runs but it does not convert the symbols to unicode text in the html preview.  It still just renders the symbol, not the unicode text.  My interpretation is the html behind the editor should be rendering as

Original content as numeric: А Б В Г Д

not 

Original content as numeric: А Б В Г Д 

This is what I am trying to accomplish.  Any thoughts would be much appreciated.  Thanks a ton for the help. 

John P.
0
Rumen
Telerik team
answered on 19 Jun 2008, 06:06 PM
Hi John,

Please, use the following code:

<telerik:radeditor id="RadEditor1" onclientload="OnClientLoad" runat="server">  
    <Content> content as Unicode: А Б В Г Д 
    <br />
    Original content as numeric: &#1040; &#1041; &#1042; &#1043; &#1044; 
    <br />  
    </Content>
</telerik:radeditor>
 
<script type="text/javascript"> 
    function OnClientLoad(editor, args) 
    { 
       editor.get_filtersManager().add(new RadEditorCustomFilter()); 
    } 
    RadEditorCustomFilter = function() 
    { 
       RadEditorCustomFilter.initializeBase(this); 
       this.set_isDom(false); 
       this.set_enabled(true); 
       this.set_name("RadEditor filter"); 
       this.set_description("RadEditor filter description"); 
    } 
    RadEditorCustomFilter.prototype = 
    { 
       getHtmlContent : function(content) 
       { 
            //Make changes to the content and return it 
            //Convert all symbols to their numeric HTML entities 
            newContent = content.replace(/А/gi, "&#1040;");  
            newContent = newContent.replace(/Б/gi, "&#1041;");  
            newContent = newContent.replace(/В/gi, "&#1042;");  
            newContent = newContent.replace(/Г/gi, "&#1043;");  
            newContent = newContent.replace(/Д/gi, "&#1044;");  
            //Go ahead and add all letters. Note: this will likely cause a performance problem  
            //newContentnewContent = newContent.toUpperCase(); 
         return newContent; 
       }
    } 
    RadEditorCustomFilter.registerClass('RadEditorCustomFilter', Telerik.Web.UI.Editor.Filter); 
</script> 



I will correct the KB articles as well.

Greetings,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Editor
Asked by
John
Top achievements
Rank 1
Answers by
Rumen
Telerik team
John
Top achievements
Rank 1
Share this question
or