I use UTF-8 in my editor, so all strings displayed here are UTF-8 in file.
I have a python script like this:
# -*- coding: utf-8 -*-
...
parser = optparse.OptionParser(description=_('automates the dice rolling in the classic game "risk"'), usage=_("usage: %prog attacking defending"))
Then I used xgettext to get everything out and got a .pot file which can be boiled down to:
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"#: auto_dice.py:16
msgid "automates the dice rolling in the classic game \"risk\""
msgstr ""
After that, I used msginit to get a de.po
which I filled in like this:
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"#: auto_dice.py:16
msgid "automates the dice rolling in the classic game \"risk\""
msgstr "automatisiert das Würfeln bei \"Risiko\""
Running the script, I get the following error:
File "/usr/lib/python2.6/optparse.py", line 1664, in print_helpfile.write(self.format_help().encode(encoding, "replace"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 60: ordinal not in range(128)
How can I fix that?