Cannot save memorial file

It’s happens when I using a translated .mo and a translated random player name.

debug message:
game.cpp[2911]: Could not open memorial file ‘memorial/瑪德琳 強森-Mon Sep 02 13-25-33 2013.txt’

I remember getting that message when I had a phantom linebreak in the filename. The OS doesn’t like those characters being in a filename. The save files get around this by base64-encoding the save file names, but that’s not as feasible for memorials as their names and contents are supposed to be human-readable.

Anyone with more knowledge of non-ASCII characters and filenames willing to chip in on this?

A quick look confirms my suspicion that this just isn’t handled properly in c++/stl, which is why we’re base64 encoding the character saves.
AFAIK the only way around this is to build a blacklist or whitelist of characters, and mangle characters we don’t support.
Aah, of course such a whiteslist exists, it looks like what we want to do is sanitize the string like (python pseudocode because reasons)

for character in name:
if !isgraph(character):
character = ‘_’

Haven’t tested it, but that’s something like what we want.

Sorry to bump this thread, but I have a fix pending for this issue that I simply don’t know how to test.


If an international user could please verify that this fixes the issue (or tell me how to input Chinese glyphs as a character name) I would appreciate it.