* src/xdisp.c (display_mode_element): Make 'c' an 'int'. Use
'string_char_and_length' to fetch the character from a multibyte
string, not 'SREF'.
(cherry picked from commit
1f891898d490380ea59f21fa8ea4e7f7364a1a79)
case Lisp_String:
{
/* A string: output it and check for %-constructs within it. */
- unsigned char c;
+ int c;
ptrdiff_t offset = 0;
if (SCHARS (elt) > 0
while ((c = SREF (elt, offset++)) >= '0' && c <= '9')
field = field * 10 + c - '0';
+ /* "%" could be followed by a multibyte character. */
+ if (STRING_MULTIBYTE (elt))
+ {
+ int length;
+ offset--;
+ c = string_char_and_length (SDATA (elt) + offset, &length);
+ offset += length;
+ }
+
/* Don't pad beyond the total padding allowed. */
if (field_width - n > 0 && field > field_width - n)
field = field_width - n;