author | Alberto Bertogli
<albertito@blitiri.com.ar> 2014-07-20 22:55:39 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2014-07-20 22:55:39 UTC |
parent | 24b2613a7d27869cc7ea83af8d46ead1fc9be826 |
urraka.cgi | +4 | -2 |
diff --git a/urraka.cgi b/urraka.cgi index 05340c5..8e87307 100755 --- a/urraka.cgi +++ b/urraka.cgi @@ -118,12 +118,14 @@ def get_mobi_title(fname): name_offset = mobi_hdr_offset + get_int(head, mobi_hdr_offset + 84) name_len = get_int(head, mobi_hdr_offset + 88) - return head[name_offset:name_offset + name_len] + title = head[name_offset:name_offset + name_len] except (IndexError, struct.error) as e: # As a fallback, palm databases have a title as the first 32 bytes; # it's usually a crippled book title. logging.debug('Error getting title for %r: %s', fname, e) - return head[:32].strip('\0') + title = head[:32].strip('\0') + + return title.decode('utf8', errors = 'replace') #