]> git.phdru.name Git - dotfiles.git/commitdiff
bin: Fix `unzip.py`
authorOleg Broytman <phd@phdru.name>
Thu, 25 Jan 2024 17:21:40 +0000 (20:21 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 25 Jan 2024 17:21:40 +0000 (20:21 +0300)
bin/unzip.py

index dd0a79f5931503e1bf358006ec2719a9eac61075..57af7b1d5a277eec95eb5b9e1e6265c57c98750d 100755 (executable)
@@ -1,7 +1,7 @@
 #! /usr/bin/env python3
 """Unzip with encoded filenames
 
-   Written by Oleg Broytman. Copyright (C) 2009-2023 PhiloSoft Design.
+   Written by Oleg Broytman. Copyright (C) 2009-2024 PhiloSoft Design.
 """
 
 import sys, os, time
@@ -27,10 +27,9 @@ out = '.'
 for zinfo in zf.infolist():
     path = zinfo.filename
     if isinstance(path, bytes):
-        path = path.decode('cp866')
-        recoded_path = path.encode(default_encoding)
+        recoded_path = path.decode('cp866').encode(default_encoding)
     else:
-        recoded_path = path.encode('cp437').decode('cp866')
+        recoded_path = path
     print(recoded_path)
 
     if path.startswith('./'):