From 3ac697f8e02b13030de44009f6f4c0f9de91fe0c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 24 Oct 2011 22:05:45 +0530 Subject: [PATCH] ODT Input: CSS rationalization should not fail with non ascii class names --- src/calibre/ebooks/odt/input.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/odt/input.py b/src/calibre/ebooks/odt/input.py index 927c43f66d..4e6bf5a4e2 100644 --- a/src/calibre/ebooks/odt/input.py +++ b/src/calibre/ebooks/odt/input.py @@ -74,7 +74,10 @@ class Extract(ODF2XHTML): style = style[0] css = style.text if css: - style.text, sel_map = self.do_filter_css(css) + css, sel_map = self.do_filter_css(css) + if not isinstance(css, unicode): + css = css.decode('utf-8', 'ignore') + style.text = css for x in root.xpath('//*[@class]'): extra = [] orig = x.get('class')