zip文件里文件夹都是乱码

百度了一下,方法都不灵。请教各位如何解决,谢谢关注。

来源:https://www.zhihu.com/question/20523036

作者:Latm Ake
链接:Linux 下 zip 文件解压乱码如何解决? - 知乎
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import zipfile

#print "Processing File " + sys.argv[1]

file=zipfile.ZipFile(sys.argv[1],"r");
for name in file.namelist():
    utf8name=name.decode('gbk')
#    print "Extracting " + utf8name
    pathname = os.path.dirname(utf8name)
    if not os.path.exists(pathname) and pathname!= "":
        os.makedirs(pathname)
    data = file.read(name)
    if not os.path.exists(utf8name):
        fo = open(utf8name, "w")
        fo.write(data)
        fo.close
file.close()

文件名存为unzip.py,压缩文件名为file.zip,执行python unzip.py file.zip

要是能将这个功能集成到Engrampa中就好了。请各位指导一下,谢谢。

记得以前搞过,貌似可以让 engrampa 默认用 unar 来解压 zip。具体方法忘了,可能是卸载 unzip/p7zip,安装 unar。

参考 https://linuxtoy.org/archives/wrong-handling-of-chinese-coded-filename-in-fileroller-unzip.html

注意这个链接最好用番羽土墙工具打开,否则评论区可能无法显示。(评论区信息量很大)

参考 https://github.com/mate-desktop/engrampa/issues/5

呃,好像不行。engrampa 依赖 p7zip-full。

感谢vickycq回复。

https://www.findhao.net/easycoding/1605 Linux文件乱码