possible problem with JNI GetStringUTFChars

Alan Snyder javalists at cbfiddle.com
Thu Jan 24 18:23:52 UTC 2019


I am having a problem with file names that contain emojis when passed to a macOS system call.

Things work when I convert the path to bytes in Java, but fail (file not found) when I convert the path to bytes in native code using GetStringUTFChars.

For example, where String.getBytes() returns

-16 -97 -115 -69

GetStringUTFChars returns:

-19 -96 -68 -19 -67 -69

I’m not a UTF expert, so can someone say whether I should file a bug report?

(Tested in JDK 9, 11, and a fairly recent 12)



More information about the core-libs-dev mailing list