From 7189c6df83da4c6c93f7bd4ec367a2f9ae040699 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mattias=20Engdeg=C3=A5rd?= Date: Sat, 5 Jul 2025 13:09:43 +0200 Subject: [PATCH] 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) --- src/lread.c | 3 +++ test/src/lread-tests.el | 5 +++++ 2 files changed, 8 insertions(+) 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 -- 2.39.5