also looking at this
fix(android): text going to the JVM is modified UTF-8, and was not being
#168
12 files
+326
-136
| @@ -120,7 +120,7 @@ pub fn read(allocator: std.mem.Allocator, j: Jni, activity: jobject) ![]u8 { | ||
| 120 | 120 | /// The label is `"Craft"`, and it is user-visible: Android 13 and later show a |
| 121 | 121 | /// preview toast naming it. Changing it because Zig now does the writing would |
| 122 | 122 | /// change what the user sees. |
| 123 | pub fn write(j: Jni, activity: jobject, text: [*:0]const u8) !void { | |
| 123 | pub fn write(j: Jni, allocator: std.mem.Allocator, activity: jobject, text: []const u8) !void { | |
| 124 | 124 | try j.pushLocalFrame(16); |
| 125 | 125 | defer _ = j.popLocalFrame(null); |
| 126 | 126 | |
| @@ -129,7 +129,7 @@ pub fn write(j: Jni, activity: jobject, text: [*:0]const u8) !void { | ||
| 129 | 129 | |
| 130 | 130 | const clip_cls = try j.findClass("android/content/ClipData"); |
| 131 | 131 | const label = try j.newStringUtf("Craft"); |
| 132 | const value = try j.newStringUtf(text); | |
| 132 | const value = try j.newStringUtf8(allocator, text); | |
| 133 | 133 | |
| 134 | 134 | // `newPlainText` takes two CharSequences; a String is one, and the JVM |
| 135 | 135 | // accepts the subtype without a cast. |