summaryrefslogtreecommitdiff
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@gnu.org>2021-03-27 14:38:56 +0900
committerEli Zaretskii <eliz@gnu.org>2021-03-27 10:42:25 +0300
commitb897bbc8135901c8edc24fc608a92d9deedeec60 (patch)
tree9c713f1654eb0548ce1e72a66dce0ff188e2614f /src/coding.c
parentc2e72610d217f52d868c62102ff25e3279510e47 (diff)
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)
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c6
1 files changed, 6 insertions, 0 deletions
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)