I use a RichTextBox in C# (.Net) where I need to replace each "*" and "+" by other Unicode chars (\u2605 and \u271A). It works fine, but the problem is when I copy content from MS Word and paste it to the RichTextBox, my two Unicode chars are replaced by "Square" ([]), not just for the pasted content but for all the content of my RichTextBox even if I reload the content from the database. I must close and re-execute my application to see my Unicode chars again.
Do you know how I could fix my problem, by an appropriate paste method or a way to reset the format of my RichTextBox ?
What I have tried:
void PasteAction(object sender, EventArgs e)
{
IDataObject data = Clipboard.GetDataObject();
if (data.GetDataPresent(DataFormats.Rtf))
{
selected = (String)data.GetData(DataFormats.Rtf);
}
else if (selected != String.Empty)
{
Clipboard.SetData(DataFormats.Rtf, selected);
}
richTextAgenda.SelectedRtf = selected;
}