JNI: NewStringUTF (modified UTF-8) mangles astral-plane chars — emoji alphabet text is corrupted in transit
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
调研方向
Start in jni_bridge.cpp: run a search for NewStringUTF and GetStringUTFChars, and check the output callback near line 189 first. The fix is to build engine-to-Kotlin strings from UTF-16 with NewString and to handle the Kotlin-to-engine direction the same way. Done when an emoji from the engine arrives intact in Kotlin, and a round-trip test with an astral-plane character passes.
由索引模型根据 Issue 内容生成。
描述
Follow-up from the #71 review loop (review M3, pre-existing).
jni_bridge.cpp uses env->NewStringUTF(...) for engine→Kotlin strings (e.g. output callback text at jni_bridge.cpp:189 and friends). JNI's NewStringUTF expects modified UTF-8 (CESU-8): 4-byte UTF-8 sequences — every astral-plane codepoint, i.e. most emoji — are invalid and get mangled. Since c003214 the app ships an Emoji alphabet, so astral chars are a live output path: the engine emits correct UTF-8, the Kotlin side receives garbage.
(The UTF-16-level coalescing contract added in #71 is correct at the Kotlin layer — ImeOutputCoalescerTest pins it — but the runtime path through JNI corrupts the string before Kotlin sees it.)
Fix pattern: decode UTF-8 → UTF-16 manually (or via String::fromUTF8 helpers) and construct with env->NewString(utf16, len). Audit every NewStringUTF in jni_bridge.cpp; also check the reverse direction (GetStringUTFChars — same modified-UTF-8 caveat) for Kotlin→engine strings (training import, seedBuffer).
Split out of #71 to keep that PR scoped to the batching fix.
- 主要语言
- Kotlin
- 星标
- 2
- 派生
- 0
- 平均合并
- 4 小时 45 分钟
- 30 天内合并 PR
- 7
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dasher-project/Dasher-Android 的其他 Issue
-
enhancement
难度 3/5 1-2 天 新手友好度 72/100
-
enhancement
难度 3/5 1-2 天 新手友好度 68/100
-
难度 4/5 3-5 天 新手友好度 68/100
-
难度 5/5 一周以上 新手友好度 42/100
-
bug
难度 5/5 一周以上 新手友好度 35/100
dasher-project/Dasher-Android#34 · 1 条评论 ·
查看 dasher-project/Dasher-Android 的全部 Issue
相似的 Issue
-
[Bug] Web Player: Misalignment in lyrics toolbar with format dropdown ('Auto') and download icon未关闭
难度 2/5 1-3 小时 新手友好度 72/100
kushagrasinghx/BitChord#1269 ·
维护者通常 1 天内回复
-
[📚] migrating-to-v27: Android fails on Expo SDK 58 (Kotlin 2.2) — document the BoM 34.19.0 override未关闭
难度 2/5 1-3 小时 新手友好度 85/100
invertase/react-native-firebase#9418 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
react/react-native#59693 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
-
Keep a caller-supplied `screen` entity instead of attaching the tracker’s current screen可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100