hkrn / nanoem

nanoem is an MMD (MikuMikuDance) compatible implementation and its like cross-platform application mainly built for macOS.
https://nanoem.rtfd.io
Other
276 stars 39 forks source link

[BUG] Unable to load dependency files with UTF-8 characters in their name on Linux #426

Closed LeadRDRK closed 5 months ago

LeadRDRK commented 6 months ago

Describe the bug Dependency files with UTF-8 characters in their name cannot be loaded on Linux.

To Reproduce Steps to reproduce the behavior:

  1. Click on Open Project (or anything else that needs to open a file)
  2. Select a file that has dependencies which have UTF-8 characters in their names.
  3. Error occurs with garbled file name, or if it's a model, loads with incomplete assets/garbled names.

Same thing happens when using drag and drop. Error seems to occur when the program tries to load the dependencies of a project/model/etc.

Expected behavior The file should load normally and the file name should not be garbled.

Screenshots When trying to open a project: image

When loading a model: image

Desktop:

Additional context Built with the following CMake invocation:

cmake -G Ninja .. -DNANOEM_ENABLE_IMGUI_FILE_DIALOG=ON

Without enabling NANOEM_ENABLE_IMGUI_FILE_DIALOG, trying to open anything that needs to select a file does nothing.

hkrn commented 5 months ago

It seems to be a similar case to issue #382. The default build options disable ICU, which is necessary for handling multibyte characters, thus preventing proper processing of multibyte characters.

Please proceed with the following steps to rebuild.

cd /path/to/nanoem/repository
git clone https://github.com/unicode-org/icu/ dependencies/icu
# checkout proper version of ICU4C automatically
cmake -P scripts/build.cmake
cmake -G Ninja .. -DNANOEM_ENABLE_IMGUI_FILE_DIALOG=ON -DNANOEM_ENABLE_BUILD_ICU4C=ON
LeadRDRK commented 5 months ago

Thank you for your response.

It's more convenient to just link to the system's libraries on Linux, so I ran CMake with these options to build it:

cmake -G Ninja .. -DNANOEM_ENABLE_IMGUI_FILE_DIALOG=ON -DNANOEM_ENABLE_ICU=ON -DICU4C_INCLUDE_DIR=/usr/include/unicode -DICU4C_I18N_LIBRARY_RELEASE=/usr/lib/libicui18n.so -DICU4C_UC_LIBRARY_RELEASE=/usr/lib/libicuuc.so -DICU4C_DATA_LIBRARY_RELEASE=/usr/lib/libicudata.so

The problem is fixed with these options enabled.