diff --git a/src/calibre/ebooks/mobi/writer.py b/src/calibre/ebooks/mobi/writer.py index 80c1bf74eb..10f1ee32d6 100644 --- a/src/calibre/ebooks/mobi/writer.py +++ b/src/calibre/ebooks/mobi/writer.py @@ -1795,12 +1795,13 @@ class MobiWriter(object): self._oeb.log.debug('Index records dumped to', t) def _clean_text_value(self, text): - if not text: - text = u'(none)' - text = text.strip() - if not isinstance(text, unicode): - text = text.decode('utf-8', 'replace') - text = text.encode('ascii','replace') + if text is not None and text.strip() : + text = text.strip() + if not isinstance(text, unicode): + text = text.decode('utf-8', 'replace') + text = text.encode('utf-8') + else : + text = "(none)".encode('utf-8') return text def _add_to_ctoc(self, ctoc_str, record_offset):