You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "G-XD (via GitHub)" <gi...@apache.org> on 2023/09/26 17:18:21 UTC

[GitHub] [incubator-opendal] G-XD opened a new issue, #3194: java binding will cause `invalid utf-8 sequence` error if passed `path` parameter contains emoji

G-XD opened a new issue, #3194:
URL: https://github.com/apache/incubator-opendal/issues/3194

   code:
   ```java
       public static void main(String[] args) {
           Map<String, String> map = new HashMap<>();
           map.put("root", "/tmp");
           try (Operator op = new Operator("fs", map)) {
               op.write("❌😱.txt", "hello OpenDAL").join();
               System.out.println(op.read("test.txt").join());
               op.delete("test.txt").join();
           }
       }
   ```
   
   error:
   ```plaintext
   Exception in thread "main" org.apache.opendal.OpenDALException: Unexpected (permanent) at  => invalid utf-8 sequence of 1 bytes from index 3, source: invalid utf-8 sequence of 1 bytes from index 3
   	at org.apache.opendal.Operator.write(Native Method)
   	at org.apache.opendal.Operator.write(Operator.java:121)
   	at org.apache.opendal.Operator.write(Operator.java:117)
   	at org.gxd.Main.main(Main.java:12)
   ```
   
   I think the cause of the problem is that the `env.get_string()` method [doesn’t automatically decode Java’s modified UTF-8 format, and we can use `.into()` to convert the returned `JavaStr`](https://docs.rs/jni/latest/jni/struct.JNIEnv.html#method.get_string).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-opendal] tisonkun closed issue #3194: java binding will cause `invalid utf-8 sequence` error if passed `path` parameter contains emoji

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun closed issue #3194: java binding will cause `invalid utf-8 sequence` error if passed `path` parameter contains emoji
URL: https://github.com/apache/incubator-opendal/issues/3194


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org