Hi,

I expected that BLOB data is returned unchanged by  
sqlite3_column_blob(), sqlite3_column_text() and  
sqlite3_column_text16(). The documentation at  
https://www.sqlite.org/c3ref/column_blob.html says: "Type conversions  
and pointer invalidations might occur in the following cases: ... The  
initial content is a BLOB and sqlite3_column_text() or  
sqlite3_column_text16() is called. A zero-terminator might need to be  
added to the string."

I have found out that SQLite does more than just adding a zero  
terminator. It seems that BLOBs are converted from UTF-8 to UTF-16  
when sqlite3_column_text16() is called.

This is quite unexpected, and it would be nice if the rules for BLOB  
encodings and BLOB encoding conversions were pointed out in the  
documentation.

Regards,
Michael

Reply via email to