BLOB Problem

I have a multiline TextArea whereby I can enter numerous lines of text.

I save this to my SQLite database as a BLOB, but when I read it back into a TextArea - I see black triangles with a question mark inside (where the return key was originally pressed).

I was under the impression that if I saved as BLOB, carriage retuns would be preserved?

Can anyone help me?

Thank you all in advance.

I’d just create it as TEXT and save it as a StringValue.

Also take a peek at:

Carriage returns yes, but not encoding.

Jeremy / Michel - if I change the database column from BLOB to TEXT, I am presuming that I still need to encode the string somehow as Michel kindly advised me?

Yes. There would be no difference saving your text to a Text field vs. a Blob field. The database does not modify what you store in it. The problem lies in the encoding of the text that you pull back out. You must call DefineEncoding to tell Xojo how to display the text (DefineEncoding does not alter the text in any way, it simply informs Xojo how to deal with it).

Thank you Michel and Jeremy - it is now working correctly :slight_smile:

I am providing the code here in case others have the same problem:

dim s as string = DefineEncoding( rs.field("Code").StringValue , Encodings.UTF8 ) CodeTextArea.text=s

Thanks Tim :slight_smile: