From ee69eb571e8878a41215f504d76dcc1eec6e918b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 3 Aug 2012 21:47:30 +0530 Subject: [PATCH] MOBI Output: Fix regression that caused non breaking space characters to be replaced by normal space in last release --- src/calibre/ebooks/mobi/writer2/serializer.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/mobi/writer2/serializer.py b/src/calibre/ebooks/mobi/writer2/serializer.py index 1e8a204ad5..2b38c1e6a6 100644 --- a/src/calibre/ebooks/mobi/writer2/serializer.py +++ b/src/calibre/ebooks/mobi/writer2/serializer.py @@ -7,11 +7,10 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import re +import re, unicodedata from calibre.ebooks.oeb.base import (OEB_DOCS, XHTML, XHTML_NS, XML_NS, namespace, prefixname, urlnormalize) -from calibre.ebooks import normalize from calibre.ebooks.mobi.mobiml import MBP_NS from calibre.ebooks.mobi.utils import is_guide_ref_start @@ -356,7 +355,9 @@ class Serializer(object): text = text.replace(u'\u00AD', '') # Soft-hyphen if quot: text = text.replace('"', '"') - self.buf.write(normalize(text).encode('utf-8')) + if isinstance(text, unicode): + text = unicodedata.normalize('NFC', text) + self.buf.write(text.encode('utf-8')) def fixup_links(self): '''