Fails on world name with special characters, and OS locale is unset (e.g on SteamDeck)
Hi! This took some digging, and I'll admit this is quite an edge case.
In short, my symptom was:
- Gaming on my Steam Deck in "gaming mode"1:
-
✅ Works in some worlds -
❌ Did not work in my multiplayer Realm that had special characters in its name. (It was namedBallebärs
) -
❌ When disconnecting from that Realm, the game just went black, and after a while it crashed.
-
- Gaming on my Steam Deck in "desktop mode":
-
✅ Works in all worlds, including that troublesome Realm
-
- Gaming on my laptop:
-
✅ Works in all worlds, including that troublesome Realm
-
On the failing realm on the Steam Deck in "gaming mode" the logs showed an InvalidPathException
error. Sorry I don't have the logs stored, but it was failing to read and write to its .../Distant_Horizons_server_data/Ballebärs/...
directory.
Turns out that when running in gaming mode, the locale environment variables were unset. Like running the locale
command in a terminal in gaming mode showed LANG=C
, LC_CTYPE=C
, LC_NUMERIC=C
etc. Don't know what just "C" stands for, but when in desktop mode the locale
command shows the expected values of LANG=en_US.UTF-8
, LC_CTYPE="en_US.UTF-8"
, etc
I had also changed the setting to use only server name as the directory, in the multiplayer settings of Distant Horizons.
Workaround
I set the environment variable LC_ALL=en_US.UTF-8
before running the game.
Since I was running Minecraft trough the PrismLauncher via a flatpak, I could run the following in a console inside desktop mode to set the environment variable permanently:
flatpak override org.prismlauncher.PrismLauncher --user --env=LC_ALL=en_US.UTF-8
And then restarting Minecraft and the PrismLauncher, then it worked in the Ballebärs
-named realm.
Permanent solutions
- Could add a setting to "trim special/non-ASCII characters from directory name", and have a note that this might be helpful when running on the Steam Deck.
- Could maybe catch the
InvalidPathException
error and try show a message in the chat that says "Distant Horizons has been temporarily disabled, please try enabling 'trim special characters from directory name' setting" - Would be nice if it didn't crash when trying to log out of a server with a special name.
- Could add above workaround to the wiki
Footnotes:
-
For the uninitiated, the Steam Deck console has 2 modes: Gaming mode, which is similar to the "Steam Big Picture-mode". Desktop mode, which is just running KDE Plasma.
↩