Fix #3267 (Can not convert ebook format from ODT to LRF format.)

This commit is contained in:
Kovid Goyal 2009-08-25 17:54:21 -06:00
parent 5396c10905
commit b1ee1b622f

View File

@ -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