Properly handle non ascii quoted URLs in OPF files

This commit is contained in:
Kovid Goyal 2008-06-30 13:48:28 -07:00
parent 11c561e6f7
commit ffc6d51e1d

View File

@ -63,7 +63,11 @@ class Resource(object):
if url[0] not in ('', 'file'):
self._href = href_or_path
else:
self.path = os.path.abspath(os.path.join(basedir, unquote(url[2]).replace('/', os.sep)))
pc = url[2]
if isinstance(pc, unicode):
pc.encode('utf-8')
pc = unquote(pc).decode('utf-8')
self.path = os.path.abspath(os.path.join(basedir, pc.replace('/', os.sep)))
self.fragment = unquote(url[-1])