docker-minecraft-server: MOTD Sanitization Breaks Color Coding (using section mark symbol)
The code around line 25 of scripts/start-setupServerProperties sanitizes the MOTD text, but that causes it to be entirely broken if it contains color or other speciak formatting. All section marks (§, the character used by Minecraft as an escape character for processing formatting) are replaced with § which seems to be something to do with UTF-8 vs UTF-16 encoding. However, this causes text to look very wrong in game, as seen in the image below. Here is an example of what I mean:
This MOTD is supposed to make rainbow text that says “Testing 123”:
§c§lT§6§le§e§ls§a§lt§3§li§9§ln§5§lg §6§l1§e§l2§a§l3
However, it gets converted to the following:
§c§lT§6§le§e§ls§a§lt§3§li§9§ln§5§lg §6§l1§e§l2§a§l3
In game, it appears like this:
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 26 (14 by maintainers)
Thanks for confirming the latest changes @aaronjamt and @LapinFou
Currently building image should fix the latest scenario you confirmed. I’ll create a follow up change to also write-out the file with UTF-8 encoding rather than escaping the Unicode characters.
Yeah, I agree. I think the logic is that allowing the server to modify it, it can “correct” certain options (for instance, convert the
difficulty=from the legacy 1/2/3 numeric values to the new easy/normal/hard text format), but I feel like the server should just log a warning that says[WARN] Difficulty setting in server.properties uses legacy format (currently set to 1). Please change to "easy" instead., or something along those lines.Can you double check that you have the latest image re-pulled? I tried a few more experiments and the only way I could “break” it was to set
MOTDto the pre-escaped versionand it would double escape the backslashes:
I’ll see if I can address that, but I know that’s different than your scenario.