From fb7296711cd0d7fb6365b1ba5df3089b2eb02024 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 15 Apr 2017 11:27:19 -0400 Subject: [PATCH] Fix Windows encoding in convert stub (#2516) --- test/rsrc/convert_stub.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/rsrc/convert_stub.py b/test/rsrc/convert_stub.py index f32bce09a..cb42692d7 100755 --- a/test/rsrc/convert_stub.py +++ b/test/rsrc/convert_stub.py @@ -28,12 +28,9 @@ def convert(in_file, out_file, tag): if not isinstance(tag, bytes): tag = tag.encode('utf-8') - # On Windows, use Unicode paths. (The test harness gives them to us - # as UTF-8 bytes.) - if platform.system() == 'Windows': - if not PY2: - in_file = in_file.encode(arg_encoding()) - out_file = out_file.encode(arg_encoding()) + # On Windows, use Unicode paths. On Python 3, we get the actual, + # Unicode filenames. On Python 2, we get them as UTF-8 byes. + if platform.system() == 'Windows' and PY2: in_file = in_file.decode('utf-8') out_file = out_file.decode('utf-8')