Open VortexCoyote opened 3 years ago
I looked into this and found out that we probably have to load in another font and add a japanese/other glyph ranges to support more unicode characters.
Ref: https://github.com/ocornut/imgui/blob/master/docs/FONTS.md#font-loading-instructions
It seems that the imgui open file dialog uses UTF-8 as its coding, though the type std::string
or const char*
is used. However, in Windows const char*
means ANSI, which is not the same as UTF-8. An experiment is shown below. Change:
To:
std::ifstream chartFile{std::filesystem::path(reinterpret_cast<const char8_t*>(InPath.c_str()))}; // Regard InPath as UTF-8.
(To support char8_t, use C++20.) This makes the constructor of ifstream work, while the former one will throw a "File not found!".
Note that there are more codes to be modified.
Sample of InPath:
C:\Users\username\Desktop\测试\516517 DJ Sharpnel - Over the Fullereneshift
测试
in the path corrupts the routine, while a path in pure English will not.
Loading files with unicode currently crashes the editor. Investigate how we can support this format