diff --git a/src/calibre/ebooks/metadata/__init__.py b/src/calibre/ebooks/metadata/__init__.py index 55d46a44c2..1da348443f 100644 --- a/src/calibre/ebooks/metadata/__init__.py +++ b/src/calibre/ebooks/metadata/__init__.py @@ -97,7 +97,8 @@ def author_to_author_sort( author_use_surname_prefixes = tweaks['author_use_surname_prefixes'] if use_surname_prefixes is None else use_surname_prefixes if author_use_surname_prefixes: - author_surname_prefixes = frozenset(x.lower() for x in (tweaks['author_surname_prefixes'] if surname_prefixes is None else surname_prefixes)) + author_surname_prefixes = frozenset( + force_unicode(x).lower() for x in (tweaks['author_surname_prefixes'] if surname_prefixes is None else surname_prefixes)) if len(tokens) == 2 and tokens[0].lower() in author_surname_prefixes: return author diff --git a/src/calibre/ebooks/metadata/test_author_sort.py b/src/calibre/ebooks/metadata/test_author_sort.py index 29e79eda78..9f9d366c69 100644 --- a/src/calibre/ebooks/metadata/test_author_sort.py +++ b/src/calibre/ebooks/metadata/test_author_sort.py @@ -102,6 +102,9 @@ class TestAuthorToAuthorSort(unittest.TestCase): self.check_all_methods('Leonardo Da Vinci', invert='Da Vinci, Leonardo', nocomma='Da Vinci Leonardo') + self.check_all_methods('Liam Da MathĂșna', + invert='Da MathĂșna, Liam', + nocomma='Da MathĂșna Liam') self.check_all_methods('Van Gogh') self.check_all_methods('Van') with Tweak('author_use_surname_prefixes', False):