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)

This commit is contained in:
Kovid Goyal 2012-07-27 15:51:41 +05:30
parent 5b5bb8caaa
commit 85ad3e9d65

View File

@ -12,7 +12,7 @@ import re
from calibre.ebooks.oeb.base import (OEB_DOCS, XHTML, XHTML_NS, XML_NS, from calibre.ebooks.oeb.base import (OEB_DOCS, XHTML, XHTML_NS, XML_NS,
namespace, prefixname, urlnormalize) namespace, prefixname, urlnormalize)
from calibre.ebooks.mobi.mobiml import MBP_NS 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 collections import defaultdict
from urlparse import urldefrag from urlparse import urldefrag
@ -355,7 +355,7 @@ class Serializer(object):
text = text.replace(u'\u00AD', '') # Soft-hyphen text = text.replace(u'\u00AD', '') # Soft-hyphen
if quot: if quot:
text = text.replace('"', '"') text = text.replace('"', '"')
self.buf.write(text.encode('utf-8')) self.buf.write(utf8_text(text))
def fixup_links(self): def fixup_links(self):
''' '''