From b1ee1b622f21f79442430c3282e6767a2e41a5dc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 25 Aug 2009 17:54:21 -0600 Subject: [PATCH] Fix #3267 (Can not convert ebook format from ODT to LRF format.) --- src/calibre/ebooks/oeb/stylizer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py index 0c387e3e84..b5d351f886 100644 --- a/src/calibre/ebooks/oeb/stylizer.py +++ b/src/calibre/ebooks/oeb/stylizer.py @@ -92,7 +92,10 @@ class CSSSelector(etree.XPath): def __init__(self, css, namespaces=XPNSMAP): css = self.MIN_SPACE_RE.sub(r'\1', css) - path = css_to_xpath(css) + try: + path = css_to_xpath(css) + except UnicodeEncodeError: # Bug in css_to_xpath + path = '/' path = self.LOCAL_NAME_RE.sub(r"local-name() = '", path) etree.XPath.__init__(self, path, namespaces=namespaces) self.css = css