パスワード付きZIPファイルの解凍

パピーリナックスを初めて使う方

モデレータ: 暇人, YoN, nyu

Endeavor_wako
記事: 380
登録日時: 09/09/18(金) 01:54

Re: パスワード付きZIPファイルの解凍

投稿記事 by Endeavor_wako »

うーん、どうもうまくいかないですね。
今度は「解凍すると文字化けするかも.zip」と同じページで使われている「UTF8.zip」が文字化けします。-I cp932が悪さしてるようです。
unx か fat かを見極めてオプションを選択しようかと思ったのですが、同一zip内に同梱されている場合も多いのでこの手は使えそうにないですね。

-I と -O 両方活かすか、片方だけにするか、運用状況に合わせて選択するしかないのかしらん。
# zipinfo -I cp932 UTF8.zip
Archive: UTF8.zip
Zip file size: 428 bytes, number of entries: 3
drwxr-xr-x 2.0 unx 0 bx stor 11-Apr-05 13:09 UTF8/
-rw-r--r-- 2.0 unx 0 bx stor 11-Apr-05 13:09 UTF8/UTF-8_SHIFTJIS繝槭ャ繝怜庄閭ス.txt
-rw-r--r-- 2.0 unx 0 bx stor 11-Apr-05 13:08 UTF8/UTF-8固有文字列_( ◕‿‿◕ ).txt
3 files, 0 bytes uncompressed, 0 bytes compressed: 0.0%
#
# zipinfo UTF8.zip
Archive: UTF8.zip
Zip file size: 428 bytes, number of entries: 3
drwxr-xr-x 2.0 unx 0 bx stor 11-Apr-05 13:09 UTF8/
-rw-r--r-- 2.0 unx 0 bx stor 11-Apr-05 13:09 UTF8/UTF-8_SHIFTJISマップ可能.txt
-rw-r--r-- 2.0 unx 0 bx stor 11-Apr-05 13:08 UTF8/UTF-8固有文字列_( ◕‿‿◕ ).txt
3 files, 0 bytes uncompressed, 0 bytes compressed: 0.0%
#


余談ですが 571JPのunzip/zipinfo は少し旧いのかも。http://packages.ubuntu.com/ja/precise-u ... も入るかも知れません

更新後のバージョン表示
# unzip --version
caution: both -n and -o specified; ignoring -o
UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.
もっとも、新しくしたところで結果は変わりませんが。
Main:NEC VersaPro VB-B (Core i5, RAM4GB, SSD, LinuxMint (xfce4,amd64))
Sub:Fujitsu note pc (Celeron、RAM8GB, SSD, LinuxMint (xfce4, amd64))

Puppyを使わなくなって久しい今日この頃。Raspiや32ビットPCにdebian入れてヘッドレスで
遊んでます。
Endeavor_wako
記事: 380
登録日時: 09/09/18(金) 01:54

Re: パスワード付きZIPファイルの解凍

投稿記事 by Endeavor_wako »

Ubuntu日本語remixのunzip がいいらしい、というので試してみました。
https://launchpad.net/~japaneseteam/+ar ... /+packages
unzip_6.0-13~5.52~ja1_i386.deb

テスト結果
# touch ほげほげ.txt
# mv ほげほげ.txt `echo ほげほげ.txt | iconv -f utf-8 -t cp932` cp932な名前のファイルを作る
# zip test2.zip `echo ほげほげ.txt | iconv -f utf-8 -t cp932`
adding: ق°ق°.txt (stored 0%)
# zipinfo test2.zip 日本語remixのzipinfo
Archive: test2.zip 156 bytes 1 file
-rw-r--r-- 2.3 unx 0 bx stor 16-Mar-15 22:04 ق°ق°.txt
1 file, 0 bytes uncompressed, 0 bytes compressed: 0.0%
# zipinfo -I cp932 test2.zip
Archive: test2.zip 156 bytes 1 file
-rw-r--r-- 2.3 unx 0 bx stor 16-Mar-15 22:04 ق°ق°.txt
1 file, 0 bytes uncompressed, 0 bytes compressed: 0.0%
# zipinfo -O cp932 test2.zip
Archive: test2.zip 156 bytes 1 file
-rw-r--r-- 2.3 unx 0 bx stor 16-Mar-15 22:04 ق°ق°.txt
1 file, 0 bytes uncompressed, 0 bytes compressed: 0.0%
#
#
# /initrd/pup_ro2/usr/bin/zipinfo test2.zip 571JPに元からあるzipinfo
Archive: test2.zip 156 bytes 1 file
-rw-r--r-- 2.3 unx 0 bx stor 16-Mar-15 22:04 ق°ق°.txt
1 file, 0 bytes uncompressed, 0 bytes compressed: 0.0%
# /initrd/pup_ro2/usr/bin/zipinfo -I cp932 test2.zip
Archive: test2.zip 156 bytes 1 file
-rw-r--r-- 2.3 unx 0 bx stor 16-Mar-15 22:04 ほげほげ.txt -I cp932 が有効
1 file, 0 bytes uncompressed, 0 bytes compressed: 0.0%
# /initrd/pup_ro2/usr/bin/zipinfo -O cp932 test2.zip
Archive: test2.zip 156 bytes 1 file
-rw-r--r-- 2.3 unx 0 bx stor 16-Mar-15 22:04 ق°ق°.txt
1 file, 0 bytes uncompressed, 0 bytes compressed: 0.0%
#
なお、前レスで被検体にした「UTF8.zip」や「解凍すると(中略).zip」 はうまくいきました。ので、上記は特殊ケースなのかも知れません(困

そのほか、unar 0.99も試してみました。展開そのものはできますがzipinfo 相当の機能がないようでXArchiveの下請けには向かないような気がします。またインストールサイズが関連ライブラリを含めて31MBもあるのもちょっと遠慮したい。

役に立たない話ですみません。
Main:NEC VersaPro VB-B (Core i5, RAM4GB, SSD, LinuxMint (xfce4,amd64))
Sub:Fujitsu note pc (Celeron、RAM8GB, SSD, LinuxMint (xfce4, amd64))

Puppyを使わなくなって久しい今日この頃。Raspiや32ビットPCにdebian入れてヘッドレスで
遊んでます。
アバター
シノバー
記事: 3139
登録日時: 09/03/21(土) 00:05
連絡する:

Xarchive ZIPファイルの解凍

投稿記事 by シノバー »

XArchive による ZIPファイルの解凍について、パピーリナックス日本語版開発時の議論を紹介します。
それは、ZIPファイルについて、Windowsで作られたものと決め打ちしようと、いうものでした。
理由は、ZIPはWindowsでよく使われ、Linuxでは ZIP に代わり gzip や bzip などが一般的だから。
以上が、開発時の議論。

いっぽう、Linux上で圧縮ファイルを送るのに、相手のOSが Widows/Mac/Linux のいずれであっても解凍しやすいようには、ZIPが良いのかもしれません。このとき、日本語ファイル名は cp932 を用いるべきでしょう。
そう考えると、NLS_OPT="-I cp932" から "-O cp932 -I cp932" が良さそうですね。

もっとも、OSを跨がることを考慮するならば、「作成するファイル名には日本語や空白を入れない」と、いうのが基本かと。
The bar master, Shino's Bar
http://shinobar.net/
返信する