freeorion icon indicating copy to clipboard operation
freeorion copied to clipboard

Failure to load system sounds and fonts on Windows with non-latin unicode path

Open Blue-Award opened this issue 7 months ago • 7 comments

One of things that popped up during investigation of https://github.com/freeorion/freeorion/issues/4978

If FreeOrion.exe on Windows is in a path with non-latin unicode characters, FreeOrion fails to load sounds and fonts. For example you get message in the debug log

[error] client : Sound.cpp:492 : PlayMusic: unable to open file C:/????????/FreeOrion/default/data/sound/artificial_intelligence_v3.ogg I/O Error. Aborting

Seems this is because things like below in ClientUI.cpp AddOptions are using path.string() that doesn't do proper utf8 conversion currently https://github.com/freeorion/freeorion/blob/7ba8f8fc314f593889f85406169cf95f5ae6abf8/UI/ClientUI.cpp#L486

Presumably good fix would be to use

https://github.com/freeorion/freeorion/blob/7ba8f8fc314f593889f85406169cf95f5ae6abf8/util/Directories.h#L180-L181

This is not happening if windows is configured into utf-8 in default locale settings but you need to get bit out of your way to set it up (it's condiered BETA setting, and on win10 since 2019, not earlier)

This is does not something critical to game running, as one can live without sounds and the roboto font, but still nice to fix.

Blue-Award avatar Jul 25 '24 21:07 Blue-Award