aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/composite.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/composite.c b/src/composite.c
index 53e6930b5f2..05365cfb65e 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1746,7 +1746,18 @@ should be ignored. */)
1746 CHECK_STRING (string); 1746 CHECK_STRING (string);
1747 validate_subarray (string, from, to, SCHARS (string), &frompos, &topos); 1747 validate_subarray (string, from, to, SCHARS (string), &frompos, &topos);
1748 if (! STRING_MULTIBYTE (string)) 1748 if (! STRING_MULTIBYTE (string))
1749 error ("Attempt to shape unibyte text"); 1749 {
1750 ptrdiff_t i;
1751
1752 for (i = SBYTES (string) - 1; i >= 0; i--)
1753 if (!ASCII_CHAR_P (SREF (string, i)))
1754 error ("Attempt to shape unibyte text");
1755 /* STRING is a pure-ASCII string, so we can convert it (or,
1756 rather, its copy) to multibyte and use that thereafter. */
1757 Lisp_Object string_copy = Fconcat (1, &string);
1758 STRING_SET_MULTIBYTE (string_copy);
1759 string = string_copy;
1760 }
1750 frombyte = string_char_to_byte (string, frompos); 1761 frombyte = string_char_to_byte (string, frompos);
1751 } 1762 }
1752 1763