V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
klesh
V2EX  ›  macOS

unzip 没有-O 选项?

  •  
  •   klesh · 2016-04-07 10:28:48 +08:00 · 6450 次点击
    这是一个创建于 2934 天前的主题,其中的信息可能已经有所发展或是发生改变。
    mac 的 unzip 不能指定页码,解压文件乱码,如何破?
    15 条回复    2019-06-17 21:33:00 +08:00
    BOYPT
        1
    BOYPT  
       2016-04-07 10:41:13 +08:00
    需要安装 unzip-iconv
    napsterwu
        2
    napsterwu  
       2016-04-08 13:06:34 +08:00
    7z
    xjbeta
        3
    xjbeta  
       2016-04-09 08:28:15 +08:00 via iPhone
    unzip --help 不就是了
    dvorak4tzx
        4
    dvorak4tzx  
       2016-04-09 14:51:59 +08:00
    这好像是个常见的无解的 bug :[File Roller/Unzip 解压中文 Zip 文件名乱码]( https://linuxtoy.org/archives/wrong-handling-of-chinese-coded-filename-in-fileroller-unzip.html)
    klesh
        5
    klesh  
    OP
       2016-04-09 15:34:53 +08:00
    @BOYPT homebrew 没有这条 formula 。搜了一圈没找到什么有用的信息
    klesh
        6
    klesh  
    OP
       2016-04-09 15:37:19 +08:00
    @napsterwu 装了 p7zip , man 了一把貌似还是没有找到指定编码的选项,默认解出来是乱码。
    @xjbeta --help 会有比 man 多出来信息吗?回头试试
    @dvorak4tzx zip 是这样的,只是奇怪 mac 下面的 unzip 没有像 linux 那样提供 -O 选项可以指定页码。
    最后装了个 The Unarchiver , mac store 里免费的软件,可以正确识别 win 下打包的 cp936 zip 文件 。
    xjbeta
        7
    xjbeta  
       2016-04-09 15:42:33 +08:00
    @klesh 只有-o (overwrite files without prompting) 并没有-O
    BOYPT
        8
    BOYPT  
       2016-04-09 21:06:06 +08:00
    @klesh unzip-iconv 是一个一直没有被 unzip 官方接纳的补丁。
    hrong
        9
    hrong  
       2016-04-10 20:56:13 +08:00
    好吧,虽然这个是在 MACOS 论坛下,但是我的解决方案是 https://dotnetzip.codeplex.com 亲测可用的。
    klesh
        10
    klesh  
    OP
       2016-04-10 21:17:29 +08:00
    @hrong 我需要的是工具,不是库。即使是自己写用 .net 也不科学呀。不过还是谢谢你 :)
    Tony8Finet
        11
    Tony8Finet  
       2016-04-11 04:03:56 +08:00
    找 unzip610b.zip, 自己编译:

    CHANGES AND NEW FEATURES
    ------------------------
    UnZip 6.10b currently adds the following features:

    - Implement Windows full Unicode support.
    - Add -I and -O options for setting ISO and OEM character sets,
    respectively, used by UnZip when doing character set translations.
    - Various cleanup of VMS and Unicode code.
    - Better handling of the PKWare verification bit.
    - Implement Acorn port changes based on patch provided by J.L. that
    updates the port to use current compilers, increases allowed file path
    lengths to 1024 characters, adds directory attributes support, and updates
    documentation.
    flybluewolf
        12
    flybluewolf  
       2016-04-11 11:24:15 +08:00   ❤️ 1
    我这两天也遇到这个问题, debian 7 上 unzip 版本没有- O 选项,后来我用了 unar 搞定:
    sudo apt-get install unar
    unar -e GBK xxx.zip
    klesh
        13
    klesh  
    OP
       2016-04-11 23:07:20 +08:00
    @flybluewolf 这个有用。

    @Tony8Finet 谢谢
    FindHao
        14
    FindHao  
       2016-04-14 14:36:59 +08:00
    http://www.findspace.name/easycoding/1605
    主要也看到了 4 楼的连接。
    现在的方法主要是 unar 和给 unzip 打补丁了。
    uxstone
        15
    uxstone  
       2019-06-17 21:33:00 +08:00
    我是从 2019 年穿越过来的
    unzip 的这个问题还存在。。。。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3750 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 10:21 · PVG 18:21 · LAX 03:21 · JFK 06:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.