From: Mattias Engdegård Date: Sat, 5 Jul 2025 11:09:43 +0000 (+0200) Subject: Read characters from functions as multibyte X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7189c6df83da4c6c93f7bd4ec367a2f9ae040699;p=emacs.git Read characters from functions as multibyte Previously, latin-1 was incorrectly assumed (bug#70988). * src/lread.c (readchar): Set multibyte flag. * test/src/lread-tests.el (lread-function-source): New test. (cherry picked from commit 553a6c407f28c4faa832c8cda462267ef75bff38) --- diff --git a/src/lread.c b/src/lread.c index 40eb6ad7875..6cd6735a215 100644 --- a/src/lread.c +++ b/src/lread.c @@ -396,6 +396,9 @@ readchar (Lisp_Object readcharfun, bool *multibyte) goto read_multibyte; } + if (multibyte) + *multibyte = 1; + tem = call0 (readcharfun); if (!FIXNUMP (tem)) diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 40640e79eed..d832cc9aa4e 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -387,4 +387,9 @@ literals (Bug#20852)." (goto-char (point-min)) (should-error (read (current-buffer)) :type 'end-of-file))) +(ert-deftest lread-function-source () + (let* ((s '(#x41 #x222a #xff -1)) + (val (read (lambda () (pop s))))) + (should (equal (symbol-name val) "A∪ÿ")))) + ;;; lread-tests.el ends here