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

RadEditor does not convert characters to entities

1 Answer 150 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Sups
Top achievements
Rank 1
Sups asked on 10 Mar 2011, 12:21 AM
Hello,

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

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 11 Mar 2011, 02:38 PM
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,
Marin
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!
Tags
Editor
Asked by
Sups
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or