Subject: bug#54591: 29.0.50; sqlite-select returns blob result as multibyte string

From: Eli Zaretskii <[email-masked]>
Date: Sat, 02 Apr 2022 08:31:52 +0300

> From: Johannes Grødem <[email-masked]>
> Date: Fri, 01 Apr 2022 20:34:49 +0200
> 
> In Python's SQLite3 API, ordinary strings are inserted as SQLite TEXTs
> and bytestrings are inserted as SQLite BLOBs, and returned as the same
> when you query. It's using a function similar to row_to_value for this,
> except that it for some reason doesn't switch on SQLITE_BLOB, it just
> calls sqlite3_column_blob and tests if it returns NULL or not and then
> it does a switch on the remaining types.

This would be leaving the responsibility for the issue to the caller,
I think.  Does SQLite TEXT allow the superset of UTF-8 encoding Emacs
uses internally to store characters that are not in Unicode?  If it
does, we could indeed assume that any BLOB is binary data and not
attempt encoding/decoding it.

> Couldn't the Emacs interface just use vectors of byte values for BLOBs
> both ways?

Why?  Unibyte strings are easier and more flexible in Emacs.

Thanks.