From 7f1521d50f5db0295f3128718b2af95a7091b5d6 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Mon, 16 Dec 2013 23:17:43 -0500 Subject: [PATCH] Encode directory name when writing to stdout. Fixes #59 on github. Saddening to see though that this was exposed because someone put a unicode dash in an otherwise normal album title. People should stop abusing unicode just because they can. --- morituri/rip/cd.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py index 1689ae0..0183764 100644 --- a/morituri/rip/cd.py +++ b/morituri/rip/cd.py @@ -288,11 +288,12 @@ Install pycdio and run 'rip offset find' to detect your drive's offset. dirname = os.path.dirname(discName) if os.path.exists(dirname): self.stdout.write("Output directory %s already exists\n" % - dirname) + dirname.encode('utf-8')) logs = glob.glob(os.path.join(dirname, '*.log')) if logs: - self.stdout.write("Output directory %s is a finished rip\n" % - dirname) + self.stdout.write( + "Output directory %s is a finished rip\n" % + dirname.encode('utf-8')) if not disambiguate: disambiguate = True continue @@ -301,7 +302,8 @@ Install pycdio and run 'rip offset find' to detect your drive's offset. break else: - self.stdout.write("Creating output directory %s\n" % dirname) + self.stdout.write("Creating output directory %s\n" % + dirname.encode('utf-8')) os.makedirs(dirname) break