bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Johannes Grødem
Subject: bug#54591: 29.0.50; sqlite-select returns blob result as multibyte string
Date: Sat, 02 Apr 2022 08:33:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Eli Zaretskii <eliz@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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]