From 94caf86d4d9405de8e8de3dc92cd450019fb6e2e Mon Sep 17 00:00:00 2001 From: Edward Li Date: Mon, 1 Feb 2021 19:40:52 +0800 Subject: [PATCH] Precompose unicode characters before displaying since HFS+ and APFS is using decomposed form --- core/rend/gui_util.cpp | 4 ++++ shell/apple/emulator-osx/emulator-osx/osx-main.mm | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/core/rend/gui_util.cpp b/core/rend/gui_util.cpp index e4959fb9e..d21de4a35 100644 --- a/core/rend/gui_util.cpp +++ b/core/rend/gui_util.cpp @@ -145,6 +145,10 @@ void select_directory_popup(const char *prompt, float scaling, StringCallback ca if (entry == NULL) break; std::string name(entry->d_name); +#ifdef __APPLE__ + extern std::string os_PrecomposedString(std::string string); + name = os_PrecomposedString(name); +#endif if (name == ".") continue; std::string child_path = path + "/" + name; diff --git a/shell/apple/emulator-osx/emulator-osx/osx-main.mm b/shell/apple/emulator-osx/emulator-osx/osx-main.mm index 62256f3a3..0dbf00070 100644 --- a/shell/apple/emulator-osx/emulator-osx/osx-main.mm +++ b/shell/apple/emulator-osx/emulator-osx/osx-main.mm @@ -252,3 +252,7 @@ extern "C" void emu_set_mouse_position(int x, int y, int width, int height) std::string os_Locale(){ return [[[NSLocale autoupdatingCurrentLocale] localeIdentifier] UTF8String]; } + +std::string os_PrecomposedString(std::string string){ + return [[[NSString stringWithUTF8String:string.c_str()] precomposedStringWithCanonicalMapping] UTF8String]; +}