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_system.zigmodified+2-2
Changes to packages/zig/src/bridge_android_system.zig
@@ -135,13 +135,13 @@ pub fn readMemory(j: Jni) !MemoryUsage {
135135/// `CraftBridge` is filtering on a string, and changing it because Zig now
136136/// emits the line would break a filter that has nothing to do with this
137137/// migration.
138pub fn writeLog(j: Jni, message: [*:0]const u8) !void {
138pub fn writeLog(j: Jni, allocator: std.mem.Allocator, message: []const u8) !void {
139139 try j.pushLocalFrame(8);
140140 defer _ = j.popLocalFrame(null);
141141
142142 const cls = try j.findClass("android/util/Log");
143143 const tag = try j.newStringUtf("CraftBridge");
144 const text = try j.newStringUtf(message);
144 const text = try j.newStringUtf8(allocator, message);
145145
146146 // `Log.d` returns the number of bytes written, which the Kotlin ignores
147147 // and so does this. Discarding it is not the same as calling a void