From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: sqlite3 Date: Sun, 12 Dec 2021 09:10:04 +0200 Message-ID: <83k0gapacz.fsf@gnu.org> References: <87tufmjyai.fsf@gnus.org> <87sfv5ljxn.fsf@gnus.org> <8735n5leza.fsf@gnus.org> <837dch1qox.fsf@gnu.org> <87ee6odu65.fsf@gnus.org> <83h7bjye0b.fsf@gnu.org> <87sfv360np.fsf@gnus.org> <83lf0vw6sg.fsf@gnu.org> <87k0gd1cl3.fsf@gnus.org> <83zgp8svkw.fsf@gnu.org> <83ilvvqwu8.fsf@gnu.org> <87bl1mihb7.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13666"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 12 08:11:52 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mwJ1T-0003SN-JL for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Dec 2021 08:11:51 +0100 Original-Received: from localhost ([::1]:54944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwJ1S-0000oJ-Ep for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Dec 2021 02:11:50 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwIzt-00007C-9Y for emacs-devel@gnu.org; Sun, 12 Dec 2021 02:10:13 -0500 Original-Received: from [2001:470:142:3::e] (port=52898 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwIzt-0004JZ-0l; Sun, 12 Dec 2021 02:10:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=wT8PuhfPw7j4bdkQn+tSYBpnWBaZzCwGRVPKuVv4HQc=; b=mrGrAhNcmm9llSMQJD/t kzY/mW8UcnADnKWrSR4eWJEAjOnjjbXuORdh3UerBG9M1GLHyuOZJjR9UPlOO6QoIvTzi/1aq507r s4Vp/oMw+oCcpfANV/5nDnqzKqo9U6/V7aIGvObJplaZRZgQVvjc63LzapdFlIXdFztDXPegxRkam oZ+7ONcFZTm+JZujfIKRsyF8cod3bfFv0bCIQe73dL6v1VgrSPGrQ2lfNeU1SijcbbkBTGnMczj2a JruGD6/Sl+mL1iMH+Kuh3FB3ARzyOxQTVV7sVnlkIlKCjMB2i1TPb9GyAPTdAhsHjt9Tan364d3u7 Sj96FwudlxLk8g==; Original-Received: from [87.69.77.57] (port=4016 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwIzs-0001lQ-PI; Sun, 12 Dec 2021 02:10:13 -0500 In-Reply-To: <87bl1mihb7.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 12 Dec 2021 05:21:48 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:281767 Archived-At: > From: Lars Ingebrigtsen > Cc: emacs-devel@gnu.org > Date: Sun, 12 Dec 2021 05:21:48 +0100 > > Eli Zaretskii writes: > > > A couple of issues that caught my eye while reading the code: > > > > . Should we invoke encode_string_utf_8 with 2 last arguments Qnil, > > and signal an error if the result is nil? That would make sure we > > were passed a valid UTF-8 string. We could also use non-zero 3rd > > argument, for speed. > > Let's see... it's these two? > > If HANDLE-8-BIT is Qt, encode eight-bit characters into single bytes > of the same value, like the usual Emacs encoding does. > > If HANDLE-OVER-UNI is Qt, encode characters beyond the Unicode > range into the same 4 or 5-byte sequence as used by Emacs > internally, like the usual Emacs encoding does. > > I think sqlite3 will give us whatever bytes have been stuffed into the > file, so I think Qt is the most useful values here. (Unless I'm missing > something.) That is, sqlite3 doesn't enforce the charset for the data, > but it does use the charset when interpreting the data (for instance, if > you select for 'ó < ź'). > > I have not read the documentation in detail on this issue, so if this is > mistaken, somebody please correct me. The documentation says "UTF-8", and my reading of that is that anything outside of that is likely to trigger "undefined behavior". There's also a question of whether we, the Emacs project, want to force using only valid UTF-8 in those interfaces. A related issue is with encoding file names, which are also expected to be in UTF-8. I don't know what will happen if a file name includes eight-bit raw bytes, for example. At least in the Windows code in sqlite3, which I did read, the result will probably be a failure to access the file. > But to answer your question, a module is currently loaded by absolute > name, and is typically "/usr/lib/sqlite3/pcre.so" (on this Debian > system, at least), and comes from the sqlite3-pcre package. But I think > there's a lot of different extensions floating around out there, so if > we decide to keep the facility, adding something PATH-like might be > nice, and figuring out the .so/DLL thing by itself might also be nice. > > So we'd have (sqlite-load-extension db 'pcre), perhaps, instead of the > absolute file name. OK, let's revisit this if and when we decide that sqlite-load-extension will stay in Emacs. Right now, it looks there are several non-trivial issues with it.