From 761cb5509c20fae8b86f429d5fb42f632a4a6d4f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 23 Sep 2012 21:52:36 +0530 Subject: [PATCH] AZW3 Output: Fix handling of & < and > entities in the text. They were being incorrectly unescaped. --- src/calibre/ebooks/mobi/writer8/skeleton.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/ebooks/mobi/writer8/skeleton.py b/src/calibre/ebooks/mobi/writer8/skeleton.py index ae8fdf364c..2c3562e87b 100644 --- a/src/calibre/ebooks/mobi/writer8/skeleton.py +++ b/src/calibre/ebooks/mobi/writer8/skeleton.py @@ -10,6 +10,7 @@ __docformat__ = 'restructuredtext en' import re from collections import namedtuple from functools import partial +from xml.sax.saxutils import escape from lxml import etree @@ -289,6 +290,7 @@ class Chunker(object): self.chunk_selector = ('S', aid) def chunk_up_text(self, text): + text = escape(text) text = text.encode('utf-8') ans = []