From 7ab2f4956049c9861510792c8b07c97703ed48bb Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 15 Jun 2024 10:04:07 +0800 Subject: [PATCH] Send proper substitution character to Android IMEs * src/androidterm.c (android_text_to_string): Substitute REPLACEMENT CHARACTER for NULL in converting characters not representable without surrogate pairs to UTF-16. (cherry picked from commit 25452986cbcf3db02cf0b5b624a03bc146b5d80c) --- src/androidterm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/androidterm.c b/src/androidterm.c index 6ae9a676f3c..730c832bb5b 100644 --- a/src/androidterm.c +++ b/src/androidterm.c @@ -5230,11 +5230,11 @@ android_text_to_string (JNIEnv *env, char *buffer, ptrdiff_t n, surrogate pairs. The hack used by Emacs is to simply replace each multibyte - character that doesn't fit in a jchar with the NULL - character. */ + character that doesn't fit in a jchar with the Unicode + replacement character. */ if (encoded >= 65536) - encoded = 0; + encoded = 0xfffd; utf16[index++] = encoded; buffer += BYTES_BY_CHAR_HEAD (*buffer); -- 2.39.2