So I’m working on the Hungarian localization and have hit a game breaking bug.
Up until a few days ago, if the hit log notification contained an accented character, it just displayed some garbage character, as seen above. Since a few days ago, the game straight out crashes.
However, this only happens when a ranged weapon hits. I’m still getting garbage characters with melee hits, but the game does not crash.
Is it possible to replace the terminal font used to display these messages with a Unicode font as well? I’m already using Cousine-Bold.ttf as a replacement font for the other typeface.
I’m using the latest experimental, build 5463, Windows x86 tiles (0.C-18110-g368db5e). If I change Cata’s language settings to English I do not get a crash.
The MO I’m using is at https://dl.dropboxusercontent.com/u/140157/cataclysm-dda.mo
Resurrecting this old threat, because zombies and also because I still can’t figure out what’s wrong.
So I’m still getting a crash, currently on a fresh install of build 6228 on Windows (0.c-21120-g65e976fea). The crash is with the Hungarian MO that I’ve converted from a partly translated English PO, itself obtained from the CDDA github. The translated PO is also available on request. Converting from the PO to the MO using msgfmt yields the following messages, but looking at the PO I see nothing out of place:
dunee@DUNEE-WIN10:/mnt/c/Users/Dunee/Desktop/hu-HU$ msgfmt cataclysm-dda.po -o cataclysm-dda.mo
cataclysm-dda.po:94806: 'msgid' and 'msgstr' entries do not both end with '\n'
cataclysm-dda.po:96626: 'msgid' and 'msgstr' entries do not both begin with '\n'
cataclysm-dda.po:96654: 'msgid' and 'msgstr' entries do not both begin with '\n'
cataclysm-dda.po:96679: 'msgid' and 'msgstr' entries do not both begin with '\n'
cataclysm-dda.po:96702: 'msgid' and 'msgstr' entries do not both begin with '\n'
cataclysm-dda.po:96735: 'msgid' and 'msgstr' entries do not both begin with '\n'
cataclysm-dda.po:96787: 'msgid' and 'msgstr' entries do not both end with '\n'
cataclysm-dda.po:96829: 'msgid' and 'msgstr' entries do not both end with '\n'
cataclysm-dda.po:96871: 'msgid' and 'msgstr' entries do not both end with '\n'
cataclysm-dda.po:96911: 'msgid' and 'msgstr' entries do not both end with '\n'
cataclysm-dda.po:96969: 'msgid' and 'msgstr' entries do not both begin with '\n'
cataclysm-dda.po:118251: 'msgid' and 'msgstr' entries do not both begin with '\n'
cataclysm-dda.po:125672: 'msgid' and 'msgstr' entries do not both end with '\n'
msgfmt: found 16 fatal errors
To reproduce the crash, use the MO from https://dl.dropboxusercontent.com/u/140157/cataclysm-dda.mo, copy it to lang\mo\fr\LC_MESSAGES, start the game, set language to French and restart the game. Spawn any ranged weapon and hit any creature nearby. The game crashes. Other than that, the Hungarian text shows up fine, especially with the new Unicode font.
I don’t even know where to start looking, debug.log has nothing. Its last line is:
21:24:36.22 INFO : Added requirement: inline_vehins_base_xlhalfboard_vertical
I have figured out since my initial post that the garbage characters have nothing to do with the crash. First, I’ve replaced all hit related text with non-accented characters. Second, the garbage characters still show up fine on a melee attack, so the issue is presumably related to some string being called when ranged weapons are fired.
I’m at a complete loss, please help!
Necroing the post again, as I’ve finally figured out what went wrong.
Apparently a long while ago I’ve changed the word order, so instead of “You hit the %s for %d” the Hungarian localization went “For %d damage you hit the %s” (more logical word order).
So that crashed to the desktop on Windows and even caused a segfault on my Ubuntu machine. Had to learn how to debug a segfault, but found it! Changed the word order back as it should be and killed my first bug (that I’ve caused in the first place).
Nothing to do with accented characters, in the end. The game displays a different string when you hit someone with a ranged weapon, something else when you melee. The errors thrown by gettext conversion don’t seem to be relevant either.
In conclusion, if you’re working on a localization, don’t assume that changing the order of variables in a string is an bulletproof thing to do.