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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user