aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2001-02-07 04:24:14 +0000
committerKenichi Handa2001-02-07 04:24:14 +0000
commita76ef35dcef6e31260e547be723b806e55e34216 (patch)
tree59b20ba4e0fa6486b95624dd31d6da53cc34a6dc /src
parentbd503487d85d78c51dae0d694b96b2a49e6ad81d (diff)
downloademacs-a76ef35dcef6e31260e547be723b806e55e34216.tar.gz
emacs-a76ef35dcef6e31260e547be723b806e55e34216.zip
(print_string): If we are going to print a unibyte
string into a multibyte buffer, convert the string to multibyte by str_to_multibyte.
Diffstat (limited to 'src')
-rw-r--r--src/print.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/print.c b/src/print.c
index aca3116eb58..e9dd4ede83f 100644
--- a/src/print.c
+++ b/src/print.c
@@ -465,8 +465,23 @@ print_string (string, printcharfun)
465 else if (EQ (printcharfun, Qt) 465 else if (EQ (printcharfun, Qt)
466 ? ! NILP (buffer_defaults.enable_multibyte_characters) 466 ? ! NILP (buffer_defaults.enable_multibyte_characters)
467 : ! NILP (current_buffer->enable_multibyte_characters)) 467 : ! NILP (current_buffer->enable_multibyte_characters))
468 chars = multibyte_chars_in_text (XSTRING (string)->data, 468 {
469 STRING_BYTES (XSTRING (string))); 469 /* If unibyte string STRING contains 8-bit codes, we must
470 convert STRING to a multibyte string containing the same
471 character codes. */
472 Lisp_Object newstr;
473 int bytes;
474
475 chars = STRING_BYTES (XSTRING (string));
476 bytes = parse_str_to_multibyte (XSTRING (string)->data, chars);
477 if (chars < bytes)
478 {
479 newstr = make_uninit_multibyte_string (chars, bytes);
480 bcopy (XSTRING (string)->data, XSTRING (newstr)->data, chars);
481 str_to_multibyte (XSTRING (newstr)->data, bytes, chars);
482 string = newstr;
483 }
484 }
470 else 485 else
471 chars = STRING_BYTES (XSTRING (string)); 486 chars = STRING_BYTES (XSTRING (string));
472 487