On Friday, 10 January, 2020 11:44, Tim Streater <t...@clothears.org.uk> wrote:

>On 10 Jan 2020, at 18:03, Richard Hipp <d...@sqlite.org> wrote:

>> On 1/10/20, Dominique Devienne <ddevie...@gmail.com> wrote:
>>> There's no way at all, to know the length of a text column with
>>> embedded NULLs?

>> You can find the true length of a string in bytes from C-code using
>> the sqlite3_column_bytes() interface.  But I cannot, off-hand, think
>> of a way to do that from SQL.

>But if I store UTF-8 in a TEXT column, surely I'm allowed to include
>NULLs in that? They are after all valid UTF-8 characters.

No, they are not.  The "NUL character" in Modified UTF-8 is the two-byte 
sequence 0xC0 0x80.  This is specifically so that 0x00 can be used as a string 
terminator.  Validly encoded UTF-8 encoded text stored in a C String (0x00 
terminated sequence of bytes) must not contain an embedded 0x00 byte since that 
byte terminates the sequence.

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.




_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to