From 826bfb8b08ae740696cfd0c55fb40c6ee9a5d14b Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 9 Jul 1998 04:33:00 +0000 Subject: [PATCH] (code_convert_string): Count characters again if we encounter some invalid code while decoding. --- src/coding.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/coding.c b/src/coding.c index 81fda21f1c..d865bd139b 100644 --- a/src/coding.c +++ b/src/coding.c @@ -4433,8 +4433,13 @@ code_convert_string (str, coding, encodep, nocopy) if (encodep) str = make_unibyte_string (buf, len + coding->produced); else - str = make_string_from_bytes (buf, len + coding->produced_char, - len + coding->produced); + { + int chars= (coding->fake_multibyte + ? multibyte_chars_in_text (buf + from, coding->produced) + : coding->produced_char); + str = make_multibyte_string (buf, len + chars, len + coding->produced); + } + return str; } -- 2.39.2