From e74166ea0996e3d5f532e5e9a13f128cc3f44ae6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 30 Jun 2008 12:05:51 -0700 Subject: [PATCH] Fix #835 --- src/calibre/ebooks/metadata/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/metadata/__init__.py b/src/calibre/ebooks/metadata/__init__.py index 7807c66a86..a511d6087a 100644 --- a/src/calibre/ebooks/metadata/__init__.py +++ b/src/calibre/ebooks/metadata/__init__.py @@ -80,14 +80,16 @@ class Resource(object): basedir = os.getcwd() if self.path is None: return self._href - frag = '#'+quote(self.fragment) if self.fragment else '' + f = self.fragment.encode('utf-8') if isinstance(self.fragment, unicode) else self.fragment + frag = '#'+quote(f) if self.fragment else '' if self.path == basedir: return ''+frag try: rpath = relpath(self.path, basedir) except OSError: # On windows path and basedir could be on different drives rpath = self.path - + if isinstance(rpath, unicode): + rpath = rpath.encode('utf-8') return quote(rpath.replace(os.sep, '/'))+frag def set_basedir(self, path):