diff options
| author | Mattias EngdegÄrd | 2024-07-18 16:16:53 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2025-07-07 11:30:07 +0200 |
| commit | f2f76756211fd5a0914734c738508f522c4b2ccd (patch) | |
| tree | 125db76722f9617cb67ad73f78ed3cdaf7680875 | |
| parent | 553a6c407f28c4faa832c8cda462267ef75bff38 (diff) | |
| download | emacs-f2f76756211fd5a0914734c738508f522c4b2ccd.tar.gz emacs-f2f76756211fd5a0914734c738508f522c4b2ccd.zip | |
Print non-ASCII chars in unibyte symbols as raw bytes
Previously, latin-1 was incorrectly assumed (bug#70988).
* src/print.c (print_object): Call the correct function.
* test/src/print-tests.el (print-unibyte-symbols): New test.
| -rw-r--r-- | src/print.c | 2 | ||||
| -rw-r--r-- | test/src/print-tests.el | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/print.c b/src/print.c index 138a21f18ab..c14e6e1419e 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -2475,7 +2475,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) | |||
| 2475 | { | 2475 | { |
| 2476 | /* Here, we must convert each multi-byte form to the | 2476 | /* Here, we must convert each multi-byte form to the |
| 2477 | corresponding character code before handing it to PRINTCHAR. */ | 2477 | corresponding character code before handing it to PRINTCHAR. */ |
| 2478 | int c = fetch_string_char_advance (name, &i, &i_byte); | 2478 | int c = fetch_string_char_as_multibyte_advance (name, &i, &i_byte); |
| 2479 | maybe_quit (); | 2479 | maybe_quit (); |
| 2480 | 2480 | ||
| 2481 | if (escapeflag) | 2481 | if (escapeflag) |
diff --git a/test/src/print-tests.el b/test/src/print-tests.el index ce8c095d496..c870427a0a9 100644 --- a/test/src/print-tests.el +++ b/test/src/print-tests.el | |||
| @@ -560,5 +560,12 @@ otherwise, use a different charset." | |||
| 560 | (ignore (make-string 100 ?b)))) | 560 | (ignore (make-string 100 ?b)))) |
| 561 | (should (equal outstr "xxx")))) | 561 | (should (equal outstr "xxx")))) |
| 562 | 562 | ||
| 563 | (ert-deftest print-unibyte-symbols () | ||
| 564 | ;; Non-ASCII in unibyte symbols should print as raw bytes. | ||
| 565 | (should (equal (prin1-to-string (make-symbol "a\xff")) | ||
| 566 | (string-to-multibyte "a\xff"))) | ||
| 567 | (should (equal (prin1-to-string (make-symbol "th\303\251")) | ||
| 568 | (string-to-multibyte "th\303\251")))) | ||
| 569 | |||
| 563 | (provide 'print-tests) | 570 | (provide 'print-tests) |
| 564 | ;;; print-tests.el ends here | 571 | ;;; print-tests.el ends here |