From 47bddb394c610beb6f582fee72706ef27e4eaf87 Mon Sep 17 00:00:00 2001 From: Johnny Robeson Date: Mon, 8 Aug 2016 23:59:54 -0400 Subject: [PATCH] decode yaml dumped data as utf-8 in edit plugin for PY2 Yaml doesn't return a true unicode string even with `allow_unicode` passed to `safe_dump_all`. --- beetsplug/edit.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/beetsplug/edit.py b/beetsplug/edit.py index 5c403adde..7f35e49bc 100644 --- a/beetsplug/edit.py +++ b/beetsplug/edit.py @@ -252,6 +252,8 @@ class EditPlugin(plugins.BeetsPlugin): encoding='utf-8') old_str = dump(old_data) new.write(old_str) + if six.PY2: + old_str = old_str.decode('utf-8') new.close() # Loop until we have parseable data and the user confirms.