Encode to ascii,not utf8.Replace missing chars

This commit is contained in:
David 2014-11-07 20:46:35 -05:00
parent fc6664455a
commit 5480ceeaf8

View file

@ -149,7 +149,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).encode('utf8')
query = re.sub(r'(?u)\W+', ' ', query).encode('ascii', "replace")
# 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)