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

Pankaj Bansal pbansal at openjdk.java.net
Thu May 6 15:32:53 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 ran this on both MacOS and Linux. The fix looks fine and solves the issue. I do not see the exception with the fix. I tested on MacOs 10.15.7 and Ubuntu 20.10 and Ubuntu 20.04.

One thing I noticed is that on linux, the file does not actually open on selection and Java stops responding. I see this on both Ubuntu 20.04 and Ubuntu 20.10. But this happens without the current fix also and not just for the file containing emojis in the filename. It is happening for all the files. So I do not think it is related to the current changes and it may be a test case issue also. I am attaching a screenshot for reference.

<img width="815" alt="error" src="https://user-images.githubusercontent.com/6153953/117324978-efc25e00-aead-11eb-9b16-fdb32359cb6a.png">

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

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


More information about the openjfx-dev mailing list