RadEditor does not convert characters to entities

2 posts, 0 answers
  1. Sups
    Sups avatar
    24 posts
    Member since:
    Jul 2007

    Posted 09 Mar 2011 Link to this post


    I just upgraded to Telerik 2010 Q3.

    I am facing issue to convert the characters to entities.
    For eg.
    If you paste this string "


    " (this resembles chinese characters) in html view and switch to design view it shows the chinese characters properly.
    Again if you switch to html view it shows the same chinese characters in there where as it should show the unicode/entities for the characters.

    I tried setting "ConvertCharactersToEntities" contentfilter but that didn't help too.

    You can reporduce the above scenario in the built-in content filters demo.

    Due to this "?????" is saved in db or when I write the content in file using RadEditor.Content property which returns the chinese characters as it is.

    I want to display chinese characters in design view and in html view it should show the entities/unicode numbers for the characters.
    By doing this RadEditor.Content property will return the unicode numbers and so in DB proper values will be saved.

    Please help me in this senario.

    Thanks in advance
  2. Marin Bratanov
    Marin Bratanov avatar
    4713 posts

    Posted 11 Mar 2011 Link to this post

    Hello Supriya,

    When non-Latin (for example, Cyrillic) content is set into an editable HTML element (for example div or iframe), the browser automatically converts symbols such as "А Б В Г Д"  to their Unicode counterparts "А Б В Г Д" - so, when JavaScript code tries to alert/obtain the content of the HTML element, it is not the "А Б В Г Д" returned, but the Unicode. The original numeric entities content has been lost.

    You can observe the same browser behavior in RadEditor too, because the Editor's content area is an editable IFRAME element.

    The solution is to override the browser's rich text editor behavior by utilizing a custom content filter. You can see an example for a similar filter in the following Knowledge Base article: http://www.telerik.com/support/kb/aspnet-ajax/editor/converting-unicode-symbols-to-numeric-html-entities-using-a-content-filter.aspx

    Please note that the built-in filter is designed only for the reserved XHTML characters. You can see the list in the following site:  http://www.digitalmediaminute.com/reference/entity/index.php. The only exception is the quotation mark as converting it to its entity would break various tag properties.

    Kind regards,
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top