fix: use real UTF-8 for jstring -> native conversion
CI / Build Java (push) Has been cancelled
CI / Build Native (macos-latest - macos) (push) Has been cancelled
CI / Build Native (ubuntu-latest - linux) (push) Has been cancelled
CI / Build Native (ubuntu-latest - windows) (push) Has been cancelled
CI / Archive Natives (push) Has been cancelled
CI / Update Binaries (push) Has been cancelled
CI / Release (push) Has been cancelled
CI / Build Java (push) Has been cancelled
CI / Build Native (macos-latest - macos) (push) Has been cancelled
CI / Build Native (ubuntu-latest - linux) (push) Has been cancelled
CI / Build Native (ubuntu-latest - windows) (push) Has been cancelled
CI / Archive Natives (push) Has been cancelled
CI / Update Binaries (push) Has been cancelled
CI / Release (push) Has been cancelled
JNI's GetStringUTFChars emits MUTF-8, which encodes codepoints above U+FFFF as a surrogate-pair of two 3-byte sequences. ImGui's UTF-8 decoder rejects those, so SMP emoji (U+1F000+) never reach the glyph atlas even when the glyph is registered. Add Jni::ToTrueUtf8 / Jni::FreeTrueUtf8 helpers in jni_common that decode via GetStringChars (UTF-16) and emit proper 1/2/3/4-byte UTF-8, then route every generator- and manually-written JNI call site through them (1921 occurrences across the generated tree and 3 hand-written files, plus the jni_content.kt generator template so future regenerations stay consistent).
This commit is contained in:
1 parent
34c40304f6
commit
d9aa2c811b
20 files changed
+3897
-3846
No files matched your search
@@ -47,4 +47,12 @@ namespace Jni
|
||||
|
||||
jobjectArray NewImGuiKeyDataArray(JNIEnv* env, const ImGuiKeyData* src, int size);
|
||||
void ImGuiKeyDataArrayCpy(JNIEnv* env, jobjectArray src, ImGuiKeyData* dst, int size);
|
||||
|
||||
// Converts a jstring to a freshly-malloc'd C string in real UTF-8 (not JNI's MUTF-8).
|
||||
// JNI's GetStringUTFChars encodes codepoints above U+FFFF as a surrogate pair of two
|
||||
// 3-byte sequences, which ImGui's UTF-8 decoder rejects — so SMP emoji never reach
|
||||
// the glyph atlas even when the glyph is registered. Caller must release with
|
||||
// FreeTrueUtf8(). Returns nullptr iff the input jstring is null.
|
||||
char* ToTrueUtf8(JNIEnv* env, jstring s);
|
||||
void FreeTrueUtf8(char* p);
|
||||
}
|
||||
Reference in new issue
Block a user