There was an error while loading. Please reload this page.
1 parent 9796297 commit f8f5d66Copy full SHA for f8f5d66
1 file changed
java_runtime/src/classes/java/io/data_input_stream.rs
@@ -185,8 +185,15 @@ impl DataInputStream {
185
let mut buf = vec![0; length as _];
186
jvm.array_raw_buffer(&java_array).await?.read(0, &mut buf)?;
187
188
- // TODO handle modified utf-8
189
- let string = RustString::from_utf8(buf).unwrap();
+ // TODO handle modified utf-8 (EUC-KR fallback)
+ let string = match RustString::from_utf8(buf) {
190
+ Ok(x) => x,
191
+ Err(e) => {
192
+ let bytes = e.into_bytes();
193
+ let (decoded, _, _) = encoding_rs::EUC_KR.decode(&bytes);
194
+ decoded.into_owned()
195
+ }
196
+ };
197
198
Ok(JavaLangString::from_rust_string(jvm, &string).await?.into())
199
}
0 commit comments