diff --git a/src/calibre/translations/msgfmt.py b/src/calibre/translations/msgfmt.py index 089f94c115..681a1d8482 100644 --- a/src/calibre/translations/msgfmt.py +++ b/src/calibre/translations/msgfmt.py @@ -166,7 +166,12 @@ def make(filename, outfile): if not msgid: # See whether there is an encoding declaration p = HeaderParser() - charset = p.parsestr(msgstr.decode(encoding)).get_content_charset() + if sys.version_info.major > 2: + charset = p.parsestr(msgstr.decode(encoding)).get_content_charset() + else: + charset = p.parsestr(msgstr.decode(encoding).encode('ascii', 'replace')).get_content_charset() + if isinstance(charset, bytes): + charset = charset.decode('ascii') if charset: encoding = charset section = ID