Win one for the Zipper!


Zip files are created with the user’s local character-set encoding. For most people in Japan, this means Shift-JIS. For most people outside of Japan, this means that you’ll get garbage file names when you unzip the file, unless you use a tool that supports manually overriding the encoding.

I couldn’t find a decent character-set-aware unzip for the Mac, so I installed the Archive::Zip module from CPAN and used the Encode module to do the conversion. Bare-bones Perl script follows.


#!/usr/bin/perl
use strict;
use Encode;
use Archive::Zip;

my $zip = Archive::Zip->new();
$zip->read($ARGV[0]) == 0 or
    die "$0: couldn't read $ARGV[0]\n";

foreach my $mref ($zip->members) {
    my $n = decode("shiftjis",$mref->fileName);
    print "Extracting $n\n";
    $zip->extractMember($mref,$n) == 0 or
        die "$0: couldn't extract $n\n";
}