X-Git-Url: https://git.phdru.name/?p=dotfiles.git;a=blobdiff_plain;f=bin%2Funzip.py;h=8fd74266b4980068adb4028afd45d2dd8f38fbdd;hp=42bf4db32de6ab56f6e9a72ceabcc40704afc09f;hb=HEAD;hpb=c5883d2a782366c0a3468a989e756cf37dabbd46 diff --git a/bin/unzip.py b/bin/unzip.py index 42bf4db..57af7b1 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-2024 PhiloSoft Design. """ import sys, os, time @@ -26,10 +26,11 @@ out = '.' for zinfo in zf.infolist(): path = zinfo.filename - if not isinstance(path, unicode): - path = path.decode('cp866') - recoded_path = path.encode(default_encoding) - print recoded_path + if isinstance(path, bytes): + recoded_path = path.decode('cp866').encode(default_encoding) + else: + recoded_path = path + print(recoded_path) if path.startswith('./'): recoded_path = recoded_path[2:]