(Freplace_match): Use make_multibyte_string or
authorKenichi Handa <handa@m17n.org>
Thu, 15 Jan 2004 11:31:57 +0000 (11:31 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 15 Jan 2004 11:31:57 +0000 (11:31 +0000)
make_unibyte_string according to the buffer multibyteness.

src/ChangeLog
src/search.c

index 1b66250..8914c65 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-15  Kenichi Handa  <handa@m17n.org>
+
+       * search.c (Freplace_match): Use make_multibyte_string or
+       make_unibyte_string according to the buffer multibyteness.
+
 2004-01-14  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * alloc.c (struct interval_block, struct string_block)
index 538cb8d..020573b 100644 (file)
@@ -2553,8 +2553,16 @@ since only regular expressions have distinguished subexpressions.  */)
        }
 
       if (really_changed)
-       newtext = make_string (substed, substed_len);
+       {
+         if (buf_multibyte)
+           {
+             int nchars = multibyte_chars_in_text (substed, substed_len);
 
+             newtext = make_multibyte_string (substed, nchars, substed_len);
+           }
+         else
+           newtext = make_unibyte_string (substed, substed_len);
+       }
       xfree (substed);
     }