diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py
index 11a718886f..2de2c599cf 100644
--- a/src/calibre/ebooks/fb2/fb2ml.py
+++ b/src/calibre/ebooks/fb2/fb2ml.py
@@ -13,10 +13,11 @@ from base64 import b64encode
from lxml import etree
+from calibre import prepare_string_for_xml
+from calibre.constants import __appname__, __version__
from calibre.ebooks.oeb.base import XHTML, XHTML_NS, barename, namespace
from calibre.ebooks.oeb.stylizer import Stylizer
from calibre.ebooks.oeb.base import OEB_IMAGES
-from calibre.constants import __appname__, __version__
TAG_MAP = {
'b' : 'strong',
@@ -56,7 +57,6 @@ class FB2MLizer(object):
output += self.fb2_body_footer()
output += self.fb2mlize_images()
output += self.fb2_footer()
- output = self.clean_text(output)
return u'\n%s' % etree.tostring(etree.fromstring(output), encoding=unicode, pretty_print=True)
def fb2_header(self):
@@ -90,11 +90,6 @@ class FB2MLizer(object):
images += '
%s
' % elem.tail + fb2_text += '%s
' % prepare_string_for_xml(elem.tail) else: - fb2_text += elem.tail + fb2_text += prepare_string_for_xml(elem.tail) return fb2_text diff --git a/src/calibre/ebooks/rb/rbml.py b/src/calibre/ebooks/rb/rbml.py index bc9248f8b0..82f8a17281 100644 --- a/src/calibre/ebooks/rb/rbml.py +++ b/src/calibre/ebooks/rb/rbml.py @@ -11,6 +11,7 @@ Transform OEB content into RB compatible markup. import os import re +from calibre import prepare_string_for_xml from calibre.ebooks.oeb.base import XHTML, XHTML_NS, barename, namespace from calibre.ebooks.oeb.stylizer import Stylizer @@ -149,7 +150,7 @@ class RBMLizer(object): # Proccess tags that contain text. if hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '': - text += elem.text + text += prepare_string_for_xml(elem.text) for item in elem: text += self.dump_text(item, stylizer, tag_stack) @@ -161,7 +162,7 @@ class RBMLizer(object): text += self.close_tags(close_tag_list) if hasattr(elem, 'tail') and elem.tail != None and elem.tail.strip() != '': - text += elem.tail + text += prepare_string_for_xml(elem.tail) return text