From e6a98f54786559c0ce248ad5d307005a5b90ffa1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 26 Nov 2015 15:34:11 +0530 Subject: [PATCH] More human friendly library ids --- src/calibre/srv/handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/srv/handler.py b/src/calibre/srv/handler.py index 56cc6868f8..98122960f5 100644 --- a/src/calibre/srv/handler.py +++ b/src/calibre/srv/handler.py @@ -7,11 +7,11 @@ __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' import os -from binascii import hexlify from collections import OrderedDict from importlib import import_module from threading import Lock +from calibre import force_unicode, filesystem_encoding from calibre.db.cache import Cache from calibre.db.legacy import create_backend, LibraryDatabase from calibre.srv.auth import AuthController @@ -36,7 +36,7 @@ class LibraryBroker(object): seen.add(path) if not LibraryDatabase.exists_at(path): continue - bname = library_id = hexlify(os.path.basename(path).encode('utf-8')).decode('ascii') + bname = library_id = force_unicode(os.path.basename(path), filesystem_encoding) c = 0 while library_id in self.lmap: c += 1