summaryrefslogtreecommitdiff
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>1998-07-09 04:33:00 +0000
committerKenichi Handa <handa@m17n.org>1998-07-09 04:33:00 +0000
commit826bfb8b08ae740696cfd0c55fb40c6ee9a5d14b (patch)
tree48954547d15b812a891043edf28068b053813dad /src/coding.c
parent973cefd24a2e4c70400ebc0a75257d086d333906 (diff)
downloademacs-826bfb8b08ae740696cfd0c55fb40c6ee9a5d14b.tar.gz
(code_convert_string): Count characters again if we
encounter some invalid code while decoding.
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/coding.c b/src/coding.c
index 81fda21f1cb..d865bd139bf 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;
}