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

Rad Editor is mangling some of my HTML in a link. Turning ~#~variable_name~#~ into %7E#%variable_name%7E#%

2 Answers 52 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Eve
Top achievements
Rank 1
Eve asked on 20 Jan 2011, 08:02 PM
Hopefully someone at Telerik can help me with this.    We use email templates for auto-responders on many of our forms.   Inside of these templates we do things like this:

<a href="http://~#~CURRENT_SERVER~#~/_blogcontrol/a.aspx?~#~approveURL~#~">APPROVE THIS COMMENT</a>

When the emails are sent out we parse the template and replace these variables with appropriate data.    I have discovered that RadEditor is turning all of our ~#~ tags into %7E#%7E.  

I know that this has something to do with encoding but I don't know how to turn it off.   I have already played around with the ContentFilters attribute...specifically I have tried setting it in codebehind like this:

txtEmailContent.ContentFilters = Telerik.Web.UI.EditorFilters.None;

I thought this would disable all filtering but the editor is still mangling my code.     What can I do to stop this behavior?

Thanks,
Eve 
Senior Designer

2 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 21 Jan 2011, 05:25 PM
Hi Eve,

This is a behavior of the Rich Text Editing engine of Firefox that the content area of RadEditor uses to render and produce HTML content.

The browser encoding is handled by the ConvertToXhtml filter and if you enable it you will not experience this problem. You can test your link in the following demo: Built-in Content Filters.

If the ConvertToXhtml filter is disabled on purpose in your application, you can easily solve the problem by implementing a custom content filter as the following one which will replace the %7E string with the ~ tilde symbol, e.g.

<telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad"></telerik:RadEditor>
<script type="text/javascript">
    function OnClientLoad(editor, args) {
 
        TildeFilter = function () {
            TildeFilter.initializeBase(this);
            this.set_isDom(false);
            this.set_enabled(true);
            this.set_name("RadEditor Bracket filter");
            this.set_description("RadEditor Bracket filter description");
        }
        TildeFilter.prototype = {
            getHtmlContent: function (content) {
 
                newContent = content.replace(/%7E/g, "~");
                return newContent;
            }
        }
        TildeFilter.registerClass('TildeFilter', Telerik.Web.UI.Editor.Filter);
        editor.get_filtersManager().add(new TildeFilter());
    }
</script>


Kind regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Eve
Top achievements
Rank 1
answered on 21 Jan 2011, 10:27 PM
Thanks honey!!! :)
Tags
Editor
Asked by
Eve
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Eve
Top achievements
Rank 1
Share this question
or