I am assigning a string to a custom type I have declared, which I Read/Write using the TTreeViews Node.Data property. I read and write to and from the node, something like this:
Read: RichEdit1.Lines.Text := TMyData(TreeView1.Selected.Data).MyString;
Write: TMyData(TreeView1.Selected.Data).MyString := RichEdit1.Lines.Text;
This works perfect for plain strings, I want to allow Rich Formatted text to be stored in the string, without losing the formatting. I managed to do this by using Streams on the RichEdit, because I am saving my database using the Freeware Zeos Lib (SQL) I get Unknown Token errors (likely from the RTF tags). How can I save without the errors?
UPDATE
I have managed to get it saving correctly without erroring now, using Base64 Encoding/Decoding as suggested by Sylverdrag. This encodes my strings removing the bad characters.
Check out http://delphi.about.com/od/adptips2003/a/bltip1203_5.htm
(My original answer was for C# - misread your question)