X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;ds=sidebyside;f=bin%2Funzip.py;h=dd0a79f5931503e1bf358006ec2719a9eac61075;hb=353abf00b2c4c65a8befd5efa8d992e56667c257;hp=42bf4db32de6ab56f6e9a72ceabcc40704afc09f;hpb=74af525d68167aa87c05c7083a2561baf4bdc71d;p=dotfiles.git diff --git a/bin/unzip.py b/bin/unzip.py index 42bf4db..dd0a79f 100755 --- a/bin/unzip.py +++ b/bin/unzip.py @@ -1,7 +1,7 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """Unzip with encoded filenames - Written by Oleg Broytman. Copyright (C) 2009-2016 PhiloSoft Design. + Written by Oleg Broytman. Copyright (C) 2009-2023 PhiloSoft Design. """ import sys, os, time @@ -26,10 +26,12 @@ out = '.' for zinfo in zf.infolist(): path = zinfo.filename - if not isinstance(path, unicode): + if isinstance(path, bytes): path = path.decode('cp866') - recoded_path = path.encode(default_encoding) - print recoded_path + recoded_path = path.encode(default_encoding) + else: + recoded_path = path.encode('cp437').decode('cp866') + print(recoded_path) if path.startswith('./'): recoded_path = recoded_path[2:]