in reply to Seeking help with Extracting files from zip
Everything works perfectly as long as my zip file has files named with Latin characters, but things get worse when the names are Chinese or Japanese.
If you can answer a couple of questions, it may give us the information that would allow us to actually help you...
Oh, one other thing: the following code works for me (Perl 5.10.1, debian oldstable amd64):
(Perlmonks seems unable or perhaps unwilling to handle most of those characters -- and if unwilling I can't blame them; this is by design an English-language venue -- but they display just fine on my terminal when I do the ls. Of course, I created my somefile.zip using the zip program that comes with Debian; yours may have been created using different software...)nathan@warthog:~/test2/extract$ ls somefile.zip nathan@warthog:~/test2/extract$ perl -e ' $filename = "somefile.zip"; $dest_dir = "/home/nathan/test2/extract"; use Archive::Zip; my $zip = Archive::Zip->new(); local $Archive::Zip::UNICODE = 1; unless ( $zip->read($filename) == AZ_OK ) { die "Error Reading Zip File !"; } foreach my $m ($zip->members()) { print "Member $m:\n "; my $err = $zip->extractMemberWithoutPaths( $m, "$dest_dir/" . $m->fi +leName); print "Error: $err" if $err; print $/; }' Member Archive::Zip::ZipFileMember=HASH(0xdfdd30): Member Archive::Zip::ZipFileMember=HASH(0xdfe2b8): Member Archive::Zip::ZipFileMember=HASH(0xdfe5a0): Member Archive::Zip::ZipFileMember=HASH(0xdfe888): Member Archive::Zip::ZipFileMember=HASH(0xdfeb98): Member Archive::Zip::ZipFileMember=HASH(0xdfee80): nathan@warthog:~/test2/extract$ ls 한국어 somefile.zip ગુજર&# +2750;તી ಕನ್ನಡ ব +94;ংলা 中文 日本語 nathan@warthog:~/test2/extract$
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Seeking help with Extracting files from zip
by aksjain (Acolyte) on Jan 14, 2015 at 14:37 UTC | |
by jonadab (Parson) on Jan 14, 2015 at 14:54 UTC | |
|
Re^2: Seeking help with Extracting files from zip
by aksjain (Acolyte) on Jan 19, 2015 at 11:25 UTC |