diff --git a/beetsplug/keyfinder.py b/beetsplug/keyfinder.py index 0ef5ac155..77312e25b 100644 --- a/beetsplug/keyfinder.py +++ b/beetsplug/keyfinder.py @@ -73,7 +73,7 @@ class KeyFinderPlugin(BeetsPlugin): key_raw = output.rsplit(None, 1)[-1] try: - key = key_raw.decode('utf8') + key = util.text_string(key_raw) except UnicodeDecodeError: self._log.error(u'output is invalid UTF-8') continue diff --git a/test/helper.py b/test/helper.py index b91d5553c..3f187d76e 100644 --- a/test/helper.py +++ b/test/helper.py @@ -431,7 +431,7 @@ class TestHelper(object): def run_with_output(self, *args): with capture_stdout() as out: self.run_command(*args) - return out.getvalue().decode('utf-8') + return util.text_string(out.getvalue()) # Safe file operations diff --git a/test/test_ui.py b/test/test_ui.py index 1257b0876..3e29c180a 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -1013,7 +1013,7 @@ class ShowChangeTest(_common.TestCase): autotag.AlbumMatch(album_dist, info, mapping, set(), set()), ) # FIXME decoding shouldn't be done here - return self.io.getoutput().lower().decode('utf8') + return util.text_string(self.io.getoutput().lower()) def test_null_change(self): msg = self._show_change()