this should fix UnicodeEncodeError with non-ascii queries

This commit is contained in:
Andrii Kohut 2014-08-24 16:37:24 +03:00
parent d0115f1110
commit 9a80179059

View file

@ -94,7 +94,7 @@ class DiscogsPlugin(BeetsPlugin):
# cause a query to return no results, even if they match the artist or
# album title. Use `re.UNICODE` flag to avoid stripping non-english
# word characters.
query = re.sub(r'(?u)\W+', ' ', query)
query = re.sub(r'(?u)\W+', ' ', query).encode('utf8')
# Strip medium information from query, Things like "CD1" and "disk 1"
# can also negate an otherwise positive result.
query = re.sub(r'(?i)\b(CD|disc)\s*\d+', '', query)