aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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