diff --git a/src/calibre/ebooks/mobi/reader/markup.py b/src/calibre/ebooks/mobi/reader/markup.py index 4eb16daa1c..e18740b70e 100644 --- a/src/calibre/ebooks/mobi/reader/markup.py +++ b/src/calibre/ebooks/mobi/reader/markup.py @@ -335,7 +335,7 @@ def expand_mobi8_markup(mobi8_reader, resource_map, log): parts = update_internal_links(mobi8_reader, log) # Remove pointless markup inserted by kindlegen - remove_kindlegen_markup(parts, mobi8_reader.aid_anchor_suffix, mobi8_reader.linked_aids) + remove_kindlegen_markup(parts, mobi8_reader.aid_anchor_suffix.decode('utf-8'), mobi8_reader.linked_aids) # Handle substitutions for the flows pieces first as they may # be inlined into the xhtml text diff --git a/src/calibre/ebooks/mobi/reader/mobi8.py b/src/calibre/ebooks/mobi/reader/mobi8.py index e87c3369bc..68ab3037b9 100644 --- a/src/calibre/ebooks/mobi/reader/mobi8.py +++ b/src/calibre/ebooks/mobi/reader/mobi8.py @@ -337,7 +337,7 @@ class Mobi8Reader(object): # See https://www.mobileread.com/forums/showthread.php?t=259557 m = self.aid_re.match(tag) if m is not None: - self.linked_aids.add(m.group(1)) + self.linked_aids.add(m.group(1).decode('utf-8')) return m.group(1) + b'-' + self.aid_anchor_suffix # No tag found, link to start of file