From 001659743d1c4b4ff3d05ccc1cdfa41736a890a7 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 21 Nov 2017 08:21:45 -0500 Subject: [PATCH] use utf-8 to codec write outputs --- run.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index 93e3682..bb4d10b 100755 --- a/run.py +++ b/run.py @@ -41,10 +41,12 @@ def run(args): #print("AFTER ".ljust(79, '-')) #print(link.after) orig_name = link.href.split('/')[-1] - with codecs.open(os.path.join(output_dir, orig_name), 'w') as f: + fn = os.path.join(output_dir, orig_name) + with codecs.open(fn, 'w', 'utf-8') as f: f.write(link.after) before_name = 'before_' + link.href.split('/')[-1] - with codecs.open(os.path.join(output_dir, before_name), 'w') as f: + fn = os.path.join(output_dir, before_name) + with codecs.open(fn, 'w', 'utf-8') as f: f.write(link.before) print("Files written to", output_dir) print()