I want to use a RichTextBox (WinForms) to manipulate plain text, so I can use rich text features for highlighting.
Plain text will be loaded to RichTextBox, edited and saved. Rich text features are only for immediate work and will not be stored.
Format of plain text in database is utf8.
I am worried there might be some unwanted change in the text string during this process:
richTextBox1.Text = LoadText();
//user and program manipulate the text, rich text features are used
SaveText(richTextBox1.Text);
Thank you.
Edit:
More specifically:
- Is there any implicit conversion when loading utf8 plain text in a RichTextBox?
- Will the Text property of a RichTextBox be identical to the string in the database if only formatting is changed, that is, can the use of rich text features affect the naked plain text string in property Text?
- Is there any limitation of the rtf format which may affect the underlying plain text?
For instance:
It seems RichTextBox changes "\r\n" to "\n" (link). This is what I would call an unwanted change. If it is only this, I could accept it or avoid it somehow, but are there other potential changes?
I know Rtf can handle any utf8 characters prefixing "\u", but is it reliable? Shall it be able to handle any character if given the appropriate font?