From 85ad3e9d657fed531f0b705c79fc7b5361bb102b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 27 Jul 2012 15:51:41 +0530 Subject: [PATCH] MOBI Output: Normalize unicode strings before writing to file, to workaround lack of support for non-normal unicode in Amazon's MOBI renderer. Fixes #1029825 (loose accentuated voyels when converting to .mobi on Kindle) --- src/calibre/ebooks/mobi/writer2/serializer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/mobi/writer2/serializer.py b/src/calibre/ebooks/mobi/writer2/serializer.py index 2dda657a93..5251bf934f 100644 --- a/src/calibre/ebooks/mobi/writer2/serializer.py +++ b/src/calibre/ebooks/mobi/writer2/serializer.py @@ -12,7 +12,7 @@ import re from calibre.ebooks.oeb.base import (OEB_DOCS, XHTML, XHTML_NS, XML_NS, namespace, prefixname, urlnormalize) from calibre.ebooks.mobi.mobiml import MBP_NS -from calibre.ebooks.mobi.utils import is_guide_ref_start +from calibre.ebooks.mobi.utils import is_guide_ref_start, utf8_text from collections import defaultdict from urlparse import urldefrag @@ -355,7 +355,7 @@ class Serializer(object): text = text.replace(u'\u00AD', '') # Soft-hyphen if quot: text = text.replace('"', '"') - self.buf.write(text.encode('utf-8')) + self.buf.write(utf8_text(text)) def fixup_links(self): '''