Skip to content
Permalink
Browse files
8210199: [linux / macOS] fileChooser can't handle emojis
Reviewed-by: pbansal, kcr
  • Loading branch information
Jose Pereda committed May 22, 2021
1 parent 240d28f commit aebac072b1919e68f7732de929dc085d00c62e92
@@ -137,10 +137,19 @@ JNIEXPORT jobject JNICALL Java_com_sun_glass_ui_gtk_GtkCommonDialogs__1showFileC
if (fnames_list_len > 0) {
jFileNames = env->NewObjectArray((jsize)fnames_list_len, jStringCls, NULL);
EXCEPTION_OCCURED(env);
const jmethodID bytesInit = env->GetMethodID(jStringCls, "<init>", "([B)V");
EXCEPTION_OCCURED(env);
for (guint i = 0; i < fnames_list_len; i++) {
filename = (char*)g_slist_nth(fnames_gslist, i)->data;
LOG1("Add [%s] into returned filenames\n", filename)
jfilename = env->NewStringUTF(filename);
int len = strlen(filename);
jbyteArray bytes = env->NewByteArray(len);
EXCEPTION_OCCURED(env);
env->SetByteArrayRegion(bytes, 0, len, (jbyte *)filename);
EXCEPTION_OCCURED(env);
jfilename = (jstring) env->NewObject(jStringCls, bytesInit, bytes);
EXCEPTION_OCCURED(env);
env->DeleteLocalRef(bytes);
EXCEPTION_OCCURED(env);
env->SetObjectArrayElement(jFileNames, (jsize)i, jfilename);
EXCEPTION_OCCURED(env);
@@ -187,8 +187,11 @@ -(void)extensionFilterChanged:(NSPopUpButton*)sender

static jobject convertNSURLtoFile(JNIEnv *env, NSURL *url)
{
LOG(" url: %s", [[url path] UTF8String]);
jstring path = (*env)->NewStringUTF(env, [[url path] UTF8String]);
#ifdef VERBOSE
NSLog(@" url: %@", [url path]);
#endif // VERBOSE
NSData *data = [[url path] dataUsingEncoding:NSUTF16LittleEndianStringEncoding];
jstring path = (*env)->NewString(env, (jchar *)[data bytes], data.length/2);

jobject ret = NULL;

1 comment on commit aebac07

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on aebac07 May 22, 2021

Please sign in to comment.