Issue #17656: Fix extraction of zip files with unicode member paths.
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 9d1a984..6639317 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -1053,7 +1053,10 @@
if os.path.sep == '\\':
# filter illegal characters on Windows
illegal = ':<>|"?*'
- table = string.maketrans(illegal, '_' * len(illegal))
+ if isinstance(arcname, unicode):
+ table = {ord(c): ord('_') for c in illegal}
+ else:
+ table = string.maketrans(illegal, '_' * len(illegal))
arcname = arcname.translate(table)
# remove trailing dots
arcname = (x.rstrip('.') for x in arcname.split(os.path.sep))