Commit d0c037d8 authored by Gerd Moellmann's avatar Gerd Moellmann
Browse files

(Fstring): If there is a multibyte char among

the args, always return a multibyte string.
parent e12489f9
No preview for this file type
......@@ -1361,19 +1361,26 @@ DEFUN ("string", Fstring, Sstring, 1, MANY, 0,
unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n);
unsigned char *p = buf;
Lisp_Object val;
int c;
int c, multibyte_p = 0;
for (i = 0; i < n; i++)
if (!INTEGERP (args[i]))
CHECK_NUMBER (args[i], 0);
CHECK_NUMBER (args[i], 0);
c = XINT (args[i]);
p += CHAR_STRING (c, p);
multibyte_p = 1;
/* Here, we can't use make_string_from_bytes because of byte
combining problem. */
val = make_string (buf, p - buf);
combining problem. Make a multibyte string if there is any
multibyte character in ARGS to make sure that `(insert 2276)'
returns a multibyte string if running --unibyte. */
if (multibyte_p)
val = make_multibyte_string (buf, n, p - buf);
val = make_unibyte_string (buf, p - buf);
return val;
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