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

RadEditor converting Greek characters to their html entities!

16 Answers 478 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Yannis
Top achievements
Rank 1
Yannis asked on 09 Jun 2010, 02:45 PM
Hello everybody,
I'm using radEditor and I noticed that when I type characters in the Greek language it converts them to their html entities. Is there a preference of some kind to avoid this behaviour? I want the editor to insert the actual unicode characters.

Thank you in advance,
Yannis Develekos

16 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 09 Jun 2010, 02:54 PM
Hi Yannis,

There is a new content filter in the latest version of RadEditor named ConvertCharactersToEntities which converts the special characters to entities. You can disable it by setting

RadEditor1.DisableFilter(Telerik.Web.UI.EditorFilters.ConvertCharactersToEntities);

in the codebehind. You can test how the content filters work in this live demo: Built-in Content Filters.

Greetings,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Yannis
Top achievements
Rank 1
answered on 09 Jun 2010, 02:57 PM
Hi Rumen,
Thanks for the super fast responce. I will give it a try.

Greetings,
Yannis
0
Yannis
Top achievements
Rank 1
answered on 08 Jul 2010, 12:19 AM
Hi Rumen,
Just wanted to know... If I disable the ConvertCharactersToEntities filter it will not convert anything at all. If I wanted to instruct the editor to stop converting just the characters of the Greek language would it be possible? For example CKEditor has something like that:
config.entities_greek = false; 

Is this possible?

Regards,
Yannis
0
Rumen
Telerik team
answered on 08 Jul 2010, 02:10 PM
Hi Yannis,

RadEditor does not offer this feature, but if more users request it we will implement it.

Currently, you can create your own custom filter that will contains only the desired symbols that you want to convert to their entities:

<telerik:radeditor OnClientLoad="OnClientLoad" runat="server" ID="RadEditor1"></telerik:radeditor>
<script type="text/javascript">
function OnClientLoad(editor, args)
{
   editor.get_filtersManager().add(new MyFilter());
}
 
MyFilter = function()
{
    MyFilter.initializeBase(this);
    this.set_isDom(false);
    this.set_enabled(true);
    this.set_name("ConvertCharactersToEntities");
    this.set_description("This filter converts reserved characters to their html entity names.");
    this.entities = {
        'euro': '\u20ac', 'cent': '\u00a2', 'pound': '\u00a3', 'yen': '\u00a5', 'sect': '\u00a7', 'copy': '\u00a9', 'reg': '\u00ae', 'plusmn': '\u00b1', 'ne': '\u2260',
        'asymp': '\u2248', 'le': '\u2264', 'ge': '\u2265', 'divide': '\u00f7', 'times': '\u00d7', 'iexcl': '\u00a1', 'curren': '\u00a4', 'brvbar': '\u00a6', 'uml': '\u00a8',
        'ordf': '\u00aa', 'trade': '\u2122', 'larr': '\u2190', 'uarr': '\u2191', 'rarr': '\u2192', 'darr': '\u2193', 'harr': '\u2194', 'crarr': '\u21b5', 'lArr': '\u21d0', 'uArr': '\u21d1',
        'rArr': '\u21d2', 'dArr': '\u21d3', 'hArr': '\u21d4', 'loz': '\u25ca', 'spades': '\u2660', 'clubs': '\u2663', 'hearts': '\u2665', 'diams': '\u2666', 'forall': '\u2200',
        'part': '\u2202', 'exist': '\u2203', 'empty': '\u2205', 'nabla': '\u2207', 'isin': '\u2208', 'notin': '\u2209', 'ni': '\u220b', 'prod': '\u220f', 'sum': '\u2211', 'minus': '\u2212',
        'lowast': '\u2217', 'radic': '\u221a', 'prop': '\u221d', 'ang': '\u2220', 'and': '\u2227', 'or': '\u2228', 'cap': '\u2229', 'cup': '\u222a', 'int': '\u222b', 'there4': '\u2234',
        'sim': '\u223c', 'cong': '\u2245', 'equiv': '\u2261', 'sub': '\u2282', 'sup': '\u2283', 'nsub': '\u2284', 'sube': '\u2286', 'supe': '\u2287', 'oplus': '\u2295', 'otimes': '\u2297',
        'perp': '\u22a5', 'sdot': '\u22c5', 'laquo': '\u00ab', 'not': '\u00ac', 'macr': '\u00af', 'deg': '\u00b0', 'sup2': '\u00b2', 'sup3': '\u00b3', 'acute': '\u00b4', 'micro': '\u00b5',
        'para': '\u00b6', 'middot': '\u00b7', 'cedil': '\u00b8', 'sup1': '\u00b9', 'ordm': '\u00ba', 'raquo': '\u00bb', 'frac14': '\u00bc', 'frac12': '\u00bd', 'frac34': '\u00be', 'iquest': '\u00bf',
        'Agrave': '\u00c0', 'Aacute': '\u00c1', 'Acirc': '\u00c2', 'Atilde': '\u00c3', 'Auml': '\u00c4', 'Aring': '\u00c5', 'AElig': '\u00c6', 'Ccedil': '\u00c7', 'Egrave': '\u00c8', 'Eacute': '\u00c9',
        'Ecirc': '\u00ca', 'Euml': '\u00cb', 'Igrave': '\u00cc', 'Iacute': '\u00cd', 'Icirc': '\u00ce', 'Iuml': '\u00cf', 'ETH': '\u00d0', 'Ntilde': '\u00d1', 'Ograve': '\u00d2', 'Oacute': '\u00d3',
        'Ocirc': '\u00d4', 'Otilde': '\u00d5', 'Ouml': '\u00d6', 'Oslash': '\u00d8', 'Ugrave': '\u00d9', 'Uacute': '\u00da', 'Ucirc': '\u00db', 'Uuml': '\u00dc', 'Yacute': '\u00dd', 'THORN': '\u00de',
        'szlig': '\u00df', 'agrave': '\u00e0', 'aacute': '\u00e1', 'acirc': '\u00e2', 'atilde': '\u00e3', 'auml': '\u00e4', 'aring': '\u00e5', 'aelig': '\u00e6', 'ccedil': '\u00e7', 'egrave': '\u00e8',
        'eacute': '\u00e9', 'ecirc': '\u00ea', 'euml': '\u00eb', 'igrave': '\u00ec', 'iacute': '\u00ed', 'icirc': '\u00ee', 'iuml': '\u00ef', 'eth': '\u00f0', 'ntilde': '\u00f1', 'ograve': '\u00f2',
        'oacute': '\u00f3', 'ocirc': '\u00f4', 'otilde': '\u00f5', 'ouml': '\u00f6', 'oslash': '\u00f8', 'ugrave': '\u00f9', 'uacute': '\u00fa', 'ucirc': '\u00fb', 'uuml': '\u00fc', 'yacute': '\u00fd',
        'thorn': '\u00fe', 'yuml': '\u00ff', 'fnof': '\u0192', 'Alpha': '\u0391', 'Beta': '\u0392', 'Gamma': '\u0393', 'Delta': '\u0394', 'Epsilon': '\u0395', 'Zeta': '\u0396', 'Eta': '\u0397',
        'Theta': '\u0398', 'Iota': '\u0399', 'Kappa': '\u039a', 'Lambda': '\u039b', 'Mu': '\u039c', 'Nu': '\u039d', 'Xi': '\u039e', 'Omicron': '\u039f', 'Pi': '\u03a0', 'Rho': '\u03a1',
        'Sigma': '\u03a3', 'Tau': '\u03a4', 'Upsilon': '\u03a5', 'Phi': '\u03a6', 'Chi': '\u03a7', 'Psi': '\u03a8', 'Omega': '\u03a9', 'alpha': '\u03b1', 'beta': '\u03b2', 'gamma': '\u03b3',
        'delta': '\u03b4', 'epsilon': '\u03b5', 'zeta': '\u03b6', 'eta': '\u03b7', 'theta': '\u03b8', 'iota': '\u03b9', 'kappa': '\u03ba', 'lambda': '\u03bb', 'mu': '\u03bc', 'nu': '\u03bd',
        'xi': '\u03be', 'omicron': '\u03bf', 'pi': '\u03c0', 'rho': '\u03c1', 'sigmaf': '\u03c2', 'sigma': '\u03c3', 'tau': '\u03c4', 'upsilon': '\u03c5', 'phi': '\u03c6', 'chi': '\u03c7', 'psi': '\u03c8',
        'omega': '\u03c9', 'thetasym': '\u03d1', 'upsih': '\u03d2', 'piv': '\u03d6', 'bull': '\u2022', 'hellip': '\u2026', 'prime': '\u2032', 'Prime': '\u2033', 'oline': '\u203e', 'frasl': '\u2044',
        'weierp': '\u2118', 'image': '\u2111', 'real': '\u211c', 'alefsym': '\u2135', 'lceil': '\u2308', 'rceil': '\u2309', 'lfloor': '\u230a', 'rfloor': '\u230b', 'lang': '\u2329', 'rang': '\u232a',
        'OElig': '\u0152', 'oelig': '\u0153', 'Scaron': '\u0160', 'scaron': '\u0161', 'Yuml': '\u0178', 'circ': '\u02c6', 'tilde': '\u02dc', 'ensp': '\u2002', 'emsp': '\u2003', 'thinsp': '\u2009', 'zwnj': '\u200c',
        'zwj': '\u200d', 'lrm': '\u200e', 'rlm': '\u200f', 'ndash': '\u2013', 'mdash': '\u2014', 'lsquo': '\u2018', 'rsquo': '\u2019', 'sbquo': '\u201a', 'ldquo': '\u201c', 'rdquo': '\u201d', 'bdquo': '\u201e',
        'dagger': '\u2020', 'Dagger': '\u2021', 'permil': '\u2030', 'lsaquo': '\u2039', 'rsaquo': '\u203a'
    };
}
 
MyFilter.prototype =
{
    getHtmlContent: function(content)
    {
        var regExp = this.createRegEx();
        var entities = this.entities;
        var newContent = content + "";
        newContent = newContent.replace(regExp, function(match, offset, fullText)
        {
            for (var entity in entities)
            {
                if (entities[entity] == match)
                {
                    return "&" + entity + ";";
                }
            }
            return match;
        });
        return newContent;
    },
 
    createRegEx: function()
    {
        var str = "[";
        var entities = this.entities;
        for (var entity in entities)
        {
            str += entities[entity];
        }
        str += "]";
        return new RegExp(str, "g");
    }
}
 
MyFilter.registerClass('Telerik.Web.UI.Editor.ConvertCharactersToEntities', Telerik.Web.UI.Editor.Filter);
</script>


Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Aristotelis Pitaridis
Top achievements
Rank 1
answered on 29 Oct 2010, 05:33 AM
I have the same problem but my RadEditor is part of the ItemTemplate inside a RadGrid. How can I apply this command in this case?
0
Rumen
Telerik team
answered on 29 Oct 2010, 01:19 PM
Hello Aristotelis Pitaridis,


Here is an example on how to get a reference to RadEditor placed in ItemDataBound of RadGrid:

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))
    {
         GridEditableItem edititem = e.Item as GridEditableItem;
         RadEditor radEditor = e.Item.FindControl("RadEditor1") as RadEditor;
         radEditor.OnClientLoad = "OnClientLoad";
    }
}

After that attach the OnClientLoad function to the OnClientLoad property of RadEditor and make sure that the JavaScript OnClientLoad function is available on the page when the editor is displayed on the page.


Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Aristotelis Pitaridis
Top achievements
Rank 1
answered on 30 Oct 2010, 06:47 AM
Thank you Rumen for your reply but I think that I found a better way to handle it. My code is the following:

Protected Sub grdArticles_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
    If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then
        Dim item As Telerik.Web.UI.GridEditFormItem = e.Item
        Dim MyRadEditor As RadEditor = item("Article").FindControl("ArticleRadEditor")
        MyRadEditor.DisableFilter(Telerik.Web.UI.EditorFilters.ConvertCharactersToEntities)
    End If
End Sub

Article is the field in which I have placed the RadEditor control and ArticleRadEditor is the name of the control. In my project it works fine. Please correct me if I have made some kind of mistake in my code.
0
Rumen
Telerik team
answered on 01 Nov 2010, 04:47 PM
Hello Aristotelis,

Your way is fine and you can use it to achieve your goal.


Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Baldwin
Top achievements
Rank 1
answered on 17 Feb 2011, 03:46 AM
How to fit the same issue for DNN RadEditor? I can't find where to place the javascript code. Any help will appreciated much.

Kind regards
Baldwin
0
Rumen
Telerik team
answered on 21 Feb 2011, 02:23 PM
Hello Baldwin,

You can see how to executing custom code called on RadEditor's events in DNN in the following KB article: Executing custom code called on RadEditor's events. This solution works only for RadEditor DNN provider provided by Telerik.

If you use the Professional DNN provider of RadEditor, you should note that it is implementation of the DNN developers and it is not supported by Telerik. Our suggestion is to post the question about how to register the external skin files of RadEditor in DNN in the DNN forums. For example in this one: Taming (customizing) The new Telerik RadEditor.


Kind regards,
Rumen
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!
0
Baldwin
Top achievements
Rank 1
answered on 24 Feb 2011, 09:58 AM
Thanks for your quick response.
But try to fix the issue with following the tutorial but no luck. The greek characters aren't rendered correctly.

For example, the sentence "Για να δουμε πως πα?ζει Ελληνικ?" will render "<p>&Gamma;&iota;&alpha; &nu;&alpha; &delta;&omicron;&upsilon;&mu;&epsilon; &pi;&omega;&sigmaf; &pi;&alpha;?&zeta;&epsilon;&iota; &Epsilon;&lambda;&lambda;&eta;&nu;&iota;&kappa;?</p>" in the HTMl mode. Any advice will be appreciated much.
0
Rumen
Telerik team
answered on 01 Mar 2011, 10:20 AM
Hi Wangji,

Did you try to disable the ConvertCharactersToEntities filter of RadEditor which converts the Greek symbols to entities? Open the configuration file and remove the ConvertCharactersToEntities string from the ContentFilters enum values:

<configuration>
  <property name="Skin">Default</property>
  <property name="NewLineBr">false</property>
  <property name="ContentFilters">EncodeScripts,FixUlBoldItalic,ConvertToXhtml,IECleanAnchors,MozEmStrong,IndentHTMLContent</property>
...

Kind regards,
Rumen
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!
0
Baldwin
Top achievements
Rank 1
answered on 01 Mar 2011, 03:27 PM
Thanks a lot for your help. It works well for us. Also I noted the issue in the post - Fixed RadEditor Issue with Converting Greek Characters to Html Entities. Hope it helps for somebody.
0
Yannis
Top achievements
Rank 1
answered on 01 Mar 2011, 03:48 PM
I believe that disabling the filter is not the best solution. This disables the conversion of symbols to entities which is not what everybody wants. I think that the problem is that the filter assumes that the letters of the greek alphabet are symbols. They are not. It's a language and the filter should not convert them at all. So I would like to be able in a future version to leave the filter on and leave the greek characters as is.

Yannis
0
Rumen
Telerik team
answered on 03 Mar 2011, 03:04 PM
Hi Yannis,

Thank you for your feature request.

We will discuss your suggestion on the next RadEditor's meeting and decide whether to remove the Greek symbols from the filter.

All the best,
Rumen
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!
0
Jie
Top achievements
Rank 1
answered on 12 Sep 2014, 06:02 PM
Hi, I am experiencing an issue with the special character encoding as well. I have a radEditor set up to have user input text then the text gets save into the database then later can display in an asp textbox or asp control. The issue I am facing is that the database is saving the & as &amp; so when I display the data on the asp control, it is showing &amp;. Is there anyway to stop the encoding so the database can save it(&) as what it is? Please shed some light. Much appreciated for the help.
Tags
Editor
Asked by
Yannis
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Yannis
Top achievements
Rank 1
Aristotelis Pitaridis
Top achievements
Rank 1
Baldwin
Top achievements
Rank 1
Jie
Top achievements
Rank 1
Share this question
or