From cfd2b3504ab5de6eb5f3c7a0784cb447883e1326 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 12 Jan 2023 16:36:35 +0200 Subject: Fix encoding with 'utf-8-auto' * src/coding.c (encode_coding_utf_8): Fix encoding with 'utf-8-auto': it should produce BOM, per the documentation of the :bom attribute. (Bug#60750) * lisp/international/mule.el (define-coding-system): Doc fix. * test/src/coding-tests.el (coding-tests): Use 'with-coding-priority' instead of 'prefer-coding-system', as the latter has global persistent effect and affects further tests. --- test/src/coding-tests.el | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'test/src/coding-tests.el') diff --git a/test/src/coding-tests.el b/test/src/coding-tests.el index 6bd8d1ae6c4..b27907027ba 100644 --- a/test/src/coding-tests.el +++ b/test/src/coding-tests.el @@ -148,21 +148,21 @@ (defun coding-tests (content-type write-coding read-coding detected-coding &optional translator) - (prefer-coding-system 'utf-8-auto) - (let ((filename (coding-tests-filename content-type write-coding))) - (with-temp-buffer - (let ((coding-system-for-read read-coding) - (contents (coding-tests-file-contents content-type)) - (disable-ascii-optimization nil)) - (if translator - (setq contents (funcall translator contents))) - (insert-file-contents filename) - (if (and (coding-system-equal buffer-file-coding-system detected-coding) - (string= (buffer-string) contents)) - nil - (list buffer-file-coding-system - (string-to-list (buffer-string)) - (string-to-list contents))))))) + (with-coding-priority '(utf-8-auto) + (let ((filename (coding-tests-filename content-type write-coding))) + (with-temp-buffer + (let ((coding-system-for-read read-coding) + (contents (coding-tests-file-contents content-type)) + (disable-ascii-optimization nil)) + (if translator + (setq contents (funcall translator contents))) + (insert-file-contents filename) + (if (and (coding-system-equal buffer-file-coding-system detected-coding) + (string= (buffer-string) contents)) + nil + (list buffer-file-coding-system + (string-to-list (buffer-string)) + (string-to-list contents)))))))) (ert-deftest ert-test-coding-ascii () (unwind-protect -- cgit v1.2.1