Fix #1590 (Title of book not read correctly for DRMed PRC files)

This commit is contained in:
Kovid Goyal 2009-01-13 14:12:41 -08:00
parent 9cf9ccd52b
commit 05b8fcb0a7

View File

@ -52,7 +52,13 @@ class EXTHHeader(object):
# print 'unknown record', id, repr(content) # print 'unknown record', id, repr(content)
title = re.search(r'\0+([^\0]+)\0+', raw[pos:]) title = re.search(r'\0+([^\0]+)\0+', raw[pos:])
if title: if title:
self.mi.title = title.group(1).decode(codec, 'ignore') title = title.group(1).decode(codec, 'replace')
if len(title) > 2:
self.mi.title = title
else:
title = re.search(r'\0+([^\0]+)\0+', ''.join(reversed(raw[pos:])))
if title:
self.mi.title = ''.join(reversed(title.group(1).decode(codec, 'replace')))
def process_metadata(self, id, content, codec): def process_metadata(self, id, content, codec):