From a35934286a290281692850794cb4c166f5e85626 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 12 Nov 2010 10:27:05 -0700 Subject: [PATCH] Fix #7355 (Adding HTML books has a problem (book is truncated)) --- src/calibre/ebooks/oeb/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 632696b4ae..2e480a9941 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -787,6 +787,8 @@ class Manifest(object): # Convert to Unicode and normalize line endings data = self.oeb.decode(data) data = self.oeb.html_preprocessor(data) + # There could be null bytes in data if it had � entities in it + data = data.replace('\0', '') # Remove DOCTYPE declaration as it messes up parsing # In particular, it causes tostring to insert xmlns