RFR: 8210199: [linux / macOS] fileChooser can't handle emojis

Kevin Rushforth kcr at openjdk.java.net
Sat May 22 12:43:01 UTC 2021


On Wed, 21 Apr 2021 10:42:04 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

> Both `GlassDialogs.m` for macOS and `GlassCommonDialogs.c` for Linux use UTF8 encoding for the file names selected via native FileChooser, and this will fail if there are emojis in the file name.
> 
> This PR uses the same approach as in [JDK-8258381](https://bugs.openjdk.java.net/browse/JDK-8258381) for macOS, using UTF16 encoding.
> 
> For Linux, the Java `String(byte[] bytes)` constructor with default charset is used instead, preventing the need of using UTF8 encoding.

I can reproduce the problem Pankaj reported on Linux, and can confirm that it is unrelated to FileChooser. It looks like some sort of deadlock that happens when calling `java.awt.Desktop::open` from the event handler. I'll file a separate bug for that.

I modified the test program to call `Files.readString(file.toPath())` instead, and can confirm that the fix works on Linux as well as on macOS.

-------------

Marked as reviewed by kcr (Lead).

PR: https://git.openjdk.java.net/jfx/pull/471


More information about the openjfx-dev mailing list