diff --git a/src/calibre/ebooks/oeb/parse_utils.py b/src/calibre/ebooks/oeb/parse_utils.py index 08bb3ee2df..88dbb2ae56 100644 --- a/src/calibre/ebooks/oeb/parse_utils.py +++ b/src/calibre/ebooks/oeb/parse_utils.py @@ -361,9 +361,11 @@ def parse_html(data, log=None, decoder=None, preprocessor=None, # Remove any encoding-specifying elements for meta in META_XP(data): meta.getparent().remove(meta) - etree.SubElement(head, XHTML('meta'), - attrib={'http-equiv': 'Content-Type', - 'content': '%s; charset=utf-8' % XHTML_NS}) + meta = etree.SubElement(head, XHTML('meta'), + attrib={'http-equiv': 'Content-Type'}) + meta.set('content', 'text/html; charset=utf-8') # Ensure content is second + # attribute + # Ensure has a if not xpath(data, '/h:html/h:body'): body = xpath(data, '//h:body')