]> git.eshelyaron.com Git - emacs.git/commitdiff
Send proper substitution character to Android IMEs
authorPo Lu <luangruo@yahoo.com>
Sat, 15 Jun 2024 02:04:07 +0000 (10:04 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sat, 15 Jun 2024 17:31:09 +0000 (19:31 +0200)
* 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

index 6ae9a676f3c9aee4f704ae7bcccb7e6a59402397..730c832bb5b9449e9af9bc8cbe1d21c95bff84aa 100644 (file)
@@ -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);