Copy some text from the introduction docs page:
Paste in RadRichTextEditor from the Demo app:
Hello,
We have decided to decline the issue as it is .NET specific. The following KB article was published for bringing more information on this topic if any other customers encounter this behavior:
Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hello,
After testing with .NET 4.0 and .NET 4.5.2 I can confirm the observed difference in the HTML content coming from the Clipboard without any custom implementation of handling the CommandExecuting event, just the default RadRichTextEditor with its functionality out of the box:
Case 1 .NET 4.0
Case 2 .NET 4.5.2
In both cases the standard Label uses the same content:
this.label1.Text = Clipboard.GetDataObject().GetData(DataFormats.Html).ToString();
It seems to be an issue with .NET 4.0 which is addressed in the later versions:
https://stackoverflow.com/a/38067962
Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hi,
I would like to follow up with some additional information related to this item. Enabling the option called "Beta: Use Unicode UTF-8 for worldwide language support" has a positive impact of the copied data to the clipboard:
We should have this Windows setting in mind when working on this item.
Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hello, Gustavo,
Thank you for reporting this undesired behavior. We will do our best to improve the behavior in RadRichTextEditor and handle the special characters in a proper way no matter what encoding comes from the clipboard's data.
Currently, the possible solution that I can suggest is to use UTF-8 encoding for inserting the HTML content in RadRichTextEditor:
public partial class RadForm1 : Telerik.WinControls.UI.RadForm
{
public RadForm1()
{
InitializeComponent();
this.radRichTextEditor1.CommandExecuting += RadRichTextEditor1_CommandExecuting;
}
private void RadRichTextEditor1_CommandExecuting(object sender, Telerik.WinForms.Documents.RichTextBoxCommands.CommandExecutingEventArgs e)
{
if (e.Command is PasteCommand)
{
e.Cancel = true;
string html = Clipboard.GetDataObject().GetData(DataFormats.Html).ToString();
// Create a UTF-8 encoding.
UTF8Encoding utf8 = new UTF8Encoding();
// Get the encoded html string.
byte[] encodedBytes = utf8.GetBytes(html);
// Decode bytes back to string.
String decodedString = utf8.GetString(encodedBytes);
if (decodedString != null)
{
HtmlFormatProvider provider = new Telerik.WinForms.Documents.FormatProviders.Html.HtmlFormatProvider();
RadDocument htmlDoc = provider.Import(decodedString.Substring(decodedString.IndexOf(@"<html>")));
this.radRichTextEditor1.RichTextBoxElement.ActiveDocumentEditor.InsertFragment(new DocumentFragment(htmlDoc));
}
}
}
}
I believe that this would fit the precise case.
Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.