From 69d2cb8b3b46a72bf592cd897c4993bcf3918a24 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 22 May 2016 22:21:28 +0530 Subject: [PATCH] Fix use of non-ascii characters in identifiers causing an error when identifier rules are used. Fixes #1584470 [URLs with file schema do not work](https://bugs.launchpad.net/calibre/+bug/1584470) --- src/calibre/ebooks/metadata/sources/identify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/metadata/sources/identify.py b/src/calibre/ebooks/metadata/sources/identify.py index 319e78caf4..c537b47209 100644 --- a/src/calibre/ebooks/metadata/sources/identify.py +++ b/src/calibre/ebooks/metadata/sources/identify.py @@ -530,7 +530,7 @@ def urls_from_identifiers(identifiers): # {{{ if rules: formatter = EvalFormatter() for k, val in identifiers.iteritems(): - vals = {'id':quote(val)} + vals = {'id':quote(val if isinstance(val, bytes) else val.encode('utf-8')).decode('ascii')} items = rules.get(k) or () for name, template in items: try: