ReviewOS

also looking at this

craft-native/craft

fix(android): text going to the JVM is modified UTF-8, and was not being

#168
Merged chris wants to merge fix/android-modified-utf8 into main
12 files +326 -136
packages/zig/src/bridge_android_clipboard.zigmodified+2-2
Changes to packages/zig/src/bridge_android_clipboard.zig
@@ -120,7 +120,7 @@ pub fn read(allocator: std.mem.Allocator, j: Jni, activity: jobject) ![]u8 {
120120/// The label is `"Craft"`, and it is user-visible: Android 13 and later show a
121121/// preview toast naming it. Changing it because Zig now does the writing would
122122/// change what the user sees.
123pub fn write(j: Jni, activity: jobject, text: [*:0]const u8) !void {
123pub fn write(j: Jni, allocator: std.mem.Allocator, activity: jobject, text: []const u8) !void {
124124 try j.pushLocalFrame(16);
125125 defer _ = j.popLocalFrame(null);
126126
@@ -129,7 +129,7 @@ pub fn write(j: Jni, activity: jobject, text: [*:0]const u8) !void {
129129
130130 const clip_cls = try j.findClass("android/content/ClipData");
131131 const label = try j.newStringUtf("Craft");
132 const value = try j.newStringUtf(text);
132 const value = try j.newStringUtf8(allocator, text);
133133
134134 // `newPlainText` takes two CharSequences; a String is one, and the JVM
135135 // accepts the subtype without a cast.