From: Kenichi Handa Date: Sat, 27 Mar 2021 05:38:56 +0000 (+0900) Subject: Fix encoding by ISO-2022-JP X-Git-Tag: emacs-28.0.90~3131 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b897bbc8135901c8edc24fc608a92d9deedeec60;p=emacs.git Fix encoding by ISO-2022-JP * src/coding.c (encode_coding): Reset the CODING_MODE_LAST_BLOCK flag for all iterations but the last one. (Bug#46933) --- diff --git a/src/coding.c b/src/coding.c index 739dd6adcb5..46e7fca0f43 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7799,7 +7799,13 @@ encode_coding (struct coding_system *coding) coding_set_source (coding); consume_chars (coding, translation_table, max_lookup); coding_set_destination (coding); + /* The CODING_MODE_LAST_BLOCK flag should be set only for the last + iteration of the encoding. */ + unsigned saved_mode = coding->mode; + if (coding->consumed_char < coding->src_chars) + coding->mode &= ~CODING_MODE_LAST_BLOCK; (*(coding->encoder)) (coding); + coding->mode = saved_mode; } while (coding->consumed_char < coding->src_chars); if (BUFFERP (coding->dst_object) && coding->produced_char > 0)