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