also looking at this
fix(android): text going to the JVM is modified UTF-8, and was not being
#168
12 files
+326
-136
| @@ -612,15 +612,12 @@ fn putString( | ||
| 612 | 612 | try j.pushLocalFrame(4); |
| 613 | 613 | defer _ = j.popLocalFrame(null); |
| 614 | 614 | |
| 615 | // `NewStringUTF` needs a NUL terminator, and a title is arbitrary page | |
| 616 | // text — so it is copied rather than pointed at. | |
| 617 | const terminated = try allocator.allocSentinel(u8, text.len, 0); | |
| 618 | defer allocator.free(terminated); | |
| 619 | @memcpy(terminated, text); | |
| 620 | ||
| 615 | // A title is arbitrary page text, so it goes through the re-encoder: a | |
| 616 | // NUL would end the string early and an emoji is a surrogate pair to the | |
| 617 | // JVM. | |
| 621 | 618 | try j.callVoidMethodA(values, put, &.{ |
| 622 | 619 | .{ .l = try j.newStringUtf(column) }, |
| 623 | .{ .l = try j.newStringUtf(terminated.ptr) }, | |
| 620 | .{ .l = try j.newStringUtf8(allocator, text) }, | |
| 624 | 621 | }); |
| 625 | 622 | } |
| 626 | 623 | |