1
votes

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.

1
@Craig - so you just need to save the RTF text into database - user532231
@daemon_x yes, I have managed to save/view the RTF text at runtime, but I cannot save the database without getting Tag or Token errors, which is not use at all if I cannot save/open the file. - user741875
@Craig - and what error message you're getting ? - user532231
@daemon_x, the error I get when I try to save is something like this: SQL Error: unrecognized token: "'????????????????%???????????????..'" - user741875
I don't know ZEOS Lib but try to to check this link. If there is a conversion AsAnsiString try to use it this way. - user532231

1 Answers

0
votes

Check out http://delphi.about.com/od/adptips2003/a/bltip1203_5.htm

(My original answer was for C# - misread your question)