diff --git a/src/calibre/customize/profiles.py b/src/calibre/customize/profiles.py index e281179565..5fb14988a5 100644 --- a/src/calibre/customize/profiles.py +++ b/src/calibre/customize/profiles.py @@ -426,7 +426,7 @@ class SonyReaderOutput(OutputProfile): dpi = 168.451 fbase = 12 fsizes = [7.5, 9, 10, 12, 15.5, 20, 22, 24] - unsupported_unicode_chars = [[u'\u2018',u'‘'], [u'\u2019',u'’'], [u'\u201a',u'‘'], [u'\u201b',u'’'], [u'\u201c',u'“'], [u'\u201d',u'”'], [u'\u201e',u'“'], [u'\u201f',u'”']] + unsupported_unicode_chars = [u'\u201f', u'\u201b'] class KoboReaderOutput(OutputProfile): diff --git a/src/calibre/ebooks/conversion/preprocess.py b/src/calibre/ebooks/conversion/preprocess.py index 36221f486b..7f384a27bd 100644 --- a/src/calibre/ebooks/conversion/preprocess.py +++ b/src/calibre/ebooks/conversion/preprocess.py @@ -520,8 +520,12 @@ class HTMLPreProcessor(object): html = self.smarten_punctuation(html) unsupported_unicode_chars = self.extra_opts.output_profile.unsupported_unicode_chars - for [char, replacement] in unsupported_unicode_chars: - html = re.sub('%s' % char, replacement, html) + if unsupported_unicode_chars != []: + from calibre.ebooks.unidecode.unidecoder import Unidecoder + unidecoder = Unidecoder() + for char in unsupported_unicode_chars: + asciichar = unidecoder.decode(char) + html = re.sub('%s' % char, asciichar, html) return html