mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1525516 [Error compressing images from the Tools menu](https://bugs.launchpad.net/calibre/+bug/1525516)
This commit is contained in:
parent
0ebb0e096b
commit
b32d5750d9
@ -9,7 +9,7 @@ from functools import partial
|
||||
from threading import Thread, Event
|
||||
from Queue import Queue, Empty
|
||||
|
||||
from calibre import detect_ncpus, human_readable
|
||||
from calibre import detect_ncpus, human_readable, force_unicode, filesystem_encoding
|
||||
|
||||
class Worker(Thread):
|
||||
|
||||
@ -82,6 +82,7 @@ def compress_images(container, report=None, names=None, jpeg_quality=None, progr
|
||||
queue.join()
|
||||
before_total = after_total = 0
|
||||
for name, (ok, res) in results.iteritems():
|
||||
name = force_unicode(name, filesystem_encoding)
|
||||
if ok:
|
||||
before, after = res
|
||||
if before != after:
|
||||
|
@ -15,7 +15,7 @@ from PyQt5.Qt import (
|
||||
QProgressBar, pyqtSignal
|
||||
)
|
||||
|
||||
from calibre import human_readable, fit_image
|
||||
from calibre import human_readable, fit_image, force_unicode
|
||||
from calibre.ebooks.oeb.polish.main import CUSTOMIZATION
|
||||
from calibre.gui2.tweak_book import tprefs, current_container, set_current_container
|
||||
from calibre.gui2.tweak_book.widgets import Dialog
|
||||
@ -56,7 +56,8 @@ def get_customization(action, name, parent):
|
||||
|
||||
def format_report(title, report):
|
||||
from calibre.ebooks.markdown import markdown
|
||||
return markdown('# %s\n\n'%title + '\n\n'.join(report), output_format='html4')
|
||||
report = [force_unicode(line) for line in report]
|
||||
return markdown('# %s\n\n'%force_unicode(title) + '\n\n'.join(report), output_format='html4')
|
||||
|
||||
def show_report(changed, title, report, parent, show_current_diff):
|
||||
report = format_report(title, report)
|
||||
|
Loading…
x
Reference in New Issue
Block a user