GNU bug report logs -
#54591
29.0.50; sqlite-select returns blob result as multibyte string
Previous Next
Reported by: Yuan Fu <casouri <at> gmail.com>
Date: Sun, 27 Mar 2022 05:50:02 UTC
Severity: normal
Found in version 29.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #32 received at submit <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> This would be leaving the responsibility for the issue to the caller,
> I think.
I think that makes sense.
> 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.
SQLite documentation says this...
TEXT. The value is a text string, stored using the database encoding
(UTF-8, UTF-16BE or UTF-16LE).
...but it's still possible to store byte sequences that are not legal
Unicode in there. This breaks the mentioned Python SQLite3 API, and
possibly others, so maybe not great if someone wants to read tables from
something else than Emacs.
Python-SQLite3 will attempt to decode it as UTF8 unless cast as a blob:
SELECT CAST(bad_text AS blob) FROM foo
(It works with the sqlite3 CLI, though.)
>> 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.
Sorry, just my lack of knowledge of Emacs types. Unibyte strings seem
fine for this.
This bug report was last modified 3 years and 22 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.