http://www.perlmonks.org?node_id=1113229

aksjain has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, I am pretty new to perl and as part of my first perl script, i need to extract files from a downloaded zip. The important part here is that the files in the zip have their names in Chinese or Japanese characters. I tried with Archive::Extract module and Archive::Zip but could not figure out how to achieve it.

$filename = "somefile.zip"; $dest_dir = "c:/somedir"; my $zip = Archive::Zip->new(); local $Archive::Zip::UNICODE = 1; unless ( $zip->read($filename) == AZ_OK ) { die "Error Reading Zip File !"; } my @members = $zip->members(); foreach (@members){ $zip->extractMemberWithoutPaths( $_, "$dest_dir\\$_"); }

I tried doing it with Archive::Extract also with following code.

my $ae = Archive::Extract->new(archive => $filename); + my $ok = $ae->extract(to => $dest_dir) or die $ae->error;

Everything works perfect till my zip file has files named with English characters, but things get worse when the names are Chinese or Japanese. Any help for this would be really appreciated.