Commit a76ef35d authored by Kenichi Handa's avatar Kenichi Handa
Browse files

(print_string): If we are going to print a unibyte

string into a multibyte buffer, convert the string to multibyte by
parent bd503487
......@@ -465,8 +465,23 @@ print_string (string, printcharfun)
else if (EQ (printcharfun, Qt)
? ! NILP (buffer_defaults.enable_multibyte_characters)
: ! NILP (current_buffer->enable_multibyte_characters))
chars = multibyte_chars_in_text (XSTRING (string)->data,
/* If unibyte string STRING contains 8-bit codes, we must
convert STRING to a multibyte string containing the same
character codes. */
Lisp_Object newstr;
int bytes;
chars = STRING_BYTES (XSTRING (string));
bytes = parse_str_to_multibyte (XSTRING (string)->data, chars);
if (chars < bytes)
newstr = make_uninit_multibyte_string (chars, bytes);
bcopy (XSTRING (string)->data, XSTRING (newstr)->data, chars);
str_to_multibyte (XSTRING (newstr)->data, bytes, chars);
string = newstr;
chars = STRING_BYTES (XSTRING (string));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment