diff --git a/beets/util/m3u.py b/beets/util/m3u.py index eca958941..d5a55a65f 100644 --- a/beets/util/m3u.py +++ b/beets/util/m3u.py @@ -39,7 +39,7 @@ class M3UFile(): def load(self): """Reads the m3u file from disk and sets the object's attributes.""" - with open(syspath(self.path), "r") as playlist_file: + with open(syspath(self.path), "r", encoding="utf-8") as playlist_file: raw_contents = playlist_file.readlines() self.extm3u = True if raw_contents[0] == "#EXTM3U\n" else False for line in raw_contents[1:]: @@ -70,6 +70,6 @@ class M3UFile(): if not self.media_list: raise EmptyPlaylistError contents = header + self.media_list - with open(syspath(self.path), "w") as playlist_file: + with open(syspath(self.path), "w", encoding="utf-8") as playlist_file: playlist_file.writelines('\n'.join(contents)) playlist_file.write('\n') # Final linefeed to prevent noeol file.