Fix #3338 (eReader not converting properly)

This commit is contained in:
Kovid Goyal 2009-08-29 09:26:57 -06:00
parent 8d55963bbd
commit ff6a6ae9e4
3 changed files with 11 additions and 4 deletions

View File

@ -105,7 +105,10 @@ class Reader132(FormatReader):
if not os.path.exists(output_dir): if not os.path.exists(output_dir):
os.makedirs(output_dir) os.makedirs(output_dir)
html = u'<html><head><title>%s</title></head><body>' % self.mi.title title = self.mi.title
if not isinstance(title, unicode):
title = title.decode('utf-8', 'replace')
html = u'<html><head><title>%s</title></head><body>' % title
pml = u'' pml = u''
for i in range(1, self.header_record.num_text_pages + 1): for i in range(1, self.header_record.num_text_pages + 1):

View File

@ -92,8 +92,12 @@ class Reader202(FormatReader):
self.log.debug('Extracting text page %i' % i) self.log.debug('Extracting text page %i' % i)
pml += self.get_text_page(i) pml += self.get_text_page(i)
title = self.mi.title
if not isinstance(title, unicode):
title = title.decode('utf-8', 'replace')
html = u'<html><head><title>%s</title></head><body>%s</body></html>' % \ html = u'<html><head><title>%s</title></head><body>%s</body></html>' % \
(self.mi.title, pml_to_html(pml)) (title, pml_to_html(pml))
with CurrentDir(output_dir): with CurrentDir(output_dir):
with open('index.html', 'wb') as index: with open('index.html', 'wb') as index:

View File

@ -13,7 +13,7 @@ class PluginWidget(Widget, Ui_Form):
HELP = _('Options specific to')+' PDB '+_('input') HELP = _('Options specific to')+' PDB '+_('input')
def __init__(self, parent, get_option, get_help, db=None, book_id=None): def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, 'txt_input', Widget.__init__(self, parent, 'pdb_input',
['single_line_paras']) ['single_line_paras'])
self.db, self.book_id = db, book_id self.db, self.book_id = db, book_id
self.initialize_options(get_option, get_help, db, book_id) self.initialize_options(get_option, get_help, db, book_id)