The data in question was binary data, not unicode. It just happened to contain some valid UTF-8 sequences. I am communicating with the db through ODBC (64-bit), so I will have to look and see what is happening exactly. I will have to add some workaround to make sure that the data is added as a BLOB.
Troy On Sat, 2020-04-11 at 14:25 +0200, László Böszörményi (GCS) wrote: > On Sat, Apr 11, 2020 at 1:56 PM Troy Korjuslommi > <t...@testing-15.tksoft.fi> wrote: > > Please note that in > > https://www.sqlite.org/lang_corefunc.html#length > > > > it says that "For a blob value X, length(X) returns the number of > > bytes > > in the blob." > Indeed, if that's a BLOB value. But as yourself noted: "when data is > valid UTF-8, it returns the number of characters" which is in sync > with the datatype notes[1]: "the datatype of a value is associated > with the value itself, not with its container". It doesn't matter > that > you defined the column as BLOB. The mentioned string (type) will be > passed to the length() function which say[2]: "returns the number of > characters (not bytes) in X". It works as its documented like you > confirm that in your original message: "it returns the number of > characters, not bytes". > You will get the same answer on the forum, this is how SQLite works > and it's documented correctly. But you are free to ask there and feel > free to report back here. > > Regards, > Laszlo/GCS > [1] https://www.sqlite.org/datatype3.htm > [2] https://www.sqlite.org/lang_corefunc.html#length