From ffc6d51e1d6132d17f9c3616489461cd6fb73991 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 30 Jun 2008 13:48:28 -0700 Subject: [PATCH] Properly handle non ascii quoted URLs in OPF files --- src/calibre/ebooks/metadata/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/metadata/__init__.py b/src/calibre/ebooks/metadata/__init__.py index c661890d88..e4fb42cc95 100644 --- a/src/calibre/ebooks/metadata/__init__.py +++ b/src/calibre/ebooks/metadata/__init__.py @@ -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])