]> code.delx.au - gnu-emacs/commitdiff
(code_convert_string): Count characters again if we
authorKenichi Handa <handa@m17n.org>
Thu, 9 Jul 1998 04:33:00 +0000 (04:33 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 9 Jul 1998 04:33:00 +0000 (04:33 +0000)
encounter some invalid code while decoding.

src/coding.c

index 81fda21f1cb6d8b718b91e2e39da36f0762767e4..d865bd139bfecac5e5180647c5a4bcb10f5dd178 100644 (file)
@@ -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;
 }