51
24

More than 3 years have passed since last update.

Macのunzipで "illegal byte sequence "

Last updated at Posted at 2019-12-27

客先から送られてきたzipファイルが何故か展開できない。ファイル名の文字コードの問題らしい。自分の環境はMac、客先はおそらくWindows。

$unzip 基本設計_20191226.zip
Archive:  基本設計_20191226.zip
checkdir error:  cannot create ???{???v_20191226
                 Illegal byte sequence
                 unable to process ???{???v_20191226/???-????????_20191226_01.xlsx.
checkdir error:  cannot create ???{???v_20191226
                 Illegal byte sequence
                 unable to process ???{???v_20191226/?Q?l?_?+?+/.
checkdir error:  cannot create ???{???v_20191226
                 Illegal byte sequence
                 unable to process ???{???v_20191226/?Q?l?_?+?+/?+???T?u?V?X?e??_?T?v????.xlsx.
checkdir error:  cannot create ???{???v_20191226
                 Illegal byte sequence
                 unable to process ???{???v_20191226/?Q?l?_?+?+/?????+???Z??.xlsx.
checkdir error:  cannot create ???{???v_20191226
                 Illegal byte sequence
                 unable to process ???{???v_20191226/?+???T?u?V?X?e??_?y???{???v?z???-?C???[?W?Q20191225.xlsx.

ちなみにFinderからzipファイルのアイコンをダブルクリックするとこうなる。
スクリーンショット 2019-12-27 10.03.26.png

unzipでなくdittoを使ったらうまく行った。dittoはMacOSX固有のコマンド。

$mkdir DESTINATIONDIRECTORY
$ditto -V -x -k --sequesterRsrc --rsrc 基本設計_20191226.zip DESTINATIONDIRECTORY

参考
https://github.com/CocoaPods/CocoaPods/issues/7711#issuecomment-386942543

dittoコマンドの説明
http://www.openspc2.org/reibun/bash/basic/018/index.html

51
24
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
51
24