mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix output encodings for ztxt and palmdoc. Modify error message to fit dialog.
This commit is contained in:
parent
a68d4899dd
commit
520e1549ce
@ -34,7 +34,7 @@ class Writer(FormatWriter):
|
||||
self.log.info('Compessing data...')
|
||||
for i in range(0, len(txt_records)):
|
||||
self.log.debug('\tCompressing record %i' % i)
|
||||
txt_records[i] = compress_doc(txt_records[i].encode('utf-8'))
|
||||
txt_records[i] = compress_doc(txt_records[i].encode('cp1252', 'replace'))
|
||||
section_lengths.append(len(txt_records[i]))
|
||||
|
||||
out_stream.seek(0)
|
||||
|
@ -33,7 +33,7 @@ class Writer(FormatWriter):
|
||||
self.log.info('Compressing data...')
|
||||
for i in range(0, len(txt_records)):
|
||||
self.log.debug('\tCompressing record %i' % i)
|
||||
txt_records[i] = compressor.compress(txt_records[i].encode('utf-8'))
|
||||
txt_records[i] = compressor.compress(txt_records[i].encode('cp1252', 'replace'))
|
||||
txt_records[i] = txt_records[i] + compressor.flush(zlib.Z_FULL_FLUSH)
|
||||
section_lengths.append(len(txt_records[i]))
|
||||
crc32 = zlib.crc32(txt_records[i], crc32) & 0xffffffff
|
||||
|
@ -55,7 +55,7 @@ class Worker(Thread):
|
||||
try:
|
||||
Thread.run(self)
|
||||
self.exception = self.traceback = None
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
self.exception = err
|
||||
self.traceback = traceback.format_exc()
|
||||
|
||||
@ -544,7 +544,7 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
||||
error_dialog(self, _('DRM Error'), _('<p>This book is protected by <a href="%s">DRM</a>')%'http://wiki.mobileread.com/wiki/DRM').exec_()
|
||||
else:
|
||||
error_dialog(self, _('Could not open ebook'),
|
||||
unicode(worker.exception), det_msg=worker.traceback, show=True)
|
||||
unicode(worker.exception.reason), det_msg=worker.traceback, show=True)
|
||||
self.close_progress_indicator()
|
||||
else:
|
||||
self.metadata.show_opf(self.iterator.opf)
|
||||
|
Loading…
x
Reference in New Issue
Block a user