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. --- src/coding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 4e59f2b6a1b..49dcd8634f3 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1431,7 +1431,7 @@ encode_coding_utf_8 (struct coding_system *coding) ptrdiff_t produced_chars = 0; int c; - if (CODING_UTF_8_BOM (coding) == utf_with_bom) + if (CODING_UTF_8_BOM (coding) != utf_without_bom) { ASSURE_DESTINATION (3); EMIT_THREE_BYTES (UTF_8_BOM_1, UTF_8_BOM_2, UTF_8_BOM_3); -- cgit v1.2.3