debian unzip 中文名乱码解决方法

2022阅读 0评论2013-01-11 zzggbb
分类:LINUX


unzip.pl

#!/usr/bin/perl

use Archive::Zip;
use Encode qw(decode encode);
     
sub usage {
print <USAGE: ZIPFILE [FROMCODE=utf-8 [TOCODE=utf-8]]
USAGE
        exit;
    }
     
    usage unless -e $ARGV[0];
    $zip = Archive::Zip->new($ARGV[0]);
    $from = $ARGV[1] || 'utf-8';
    $to = $ARGV[2] || 'utf-8';
     
    for ($zip->memberNames()) {
        $member = $zip->memberNamed($_);
        $_ = encode($to, decode($from, $_));
        $zip->extractMember($member, $_);
    }
上一篇:dnsmasq加快域名解析
下一篇:awk 输出学号为3的整数倍学生名单