changeset 22723:04b653d7f842

(code_convert_string): Count characters again if we encounter some invalid code while decoding.
author Kenichi Handa <handa@m17n.org>
date Thu, 09 Jul 1998 04:33:00 +0000
parents ef426e5873e3
children 6a6568360d51
files src/coding.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Thu Jul 09 04:03:27 1998 +0000
+++ b/src/coding.c	Thu Jul 09 04:33:00 1998 +0000
@@ -4433,8 +4433,13 @@
   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;
 }