8 use Kanconvit; # http://kanconvit.ta2o.net/
10 my $top = shift @ARGV || exit;
11 if (! -d $top) { exit; }
13 my $utf8 = find_encoding("utf8");
14 my $ck = Kanconvit->new();
21 $str = $utf8->decode($str);
22 my $sjis = encode("cp932", $str, Encode::FB_HTMLCREF);
23 if ($sjis =~ /&#\d{4,};/) {
24 my $jtext = $ck->conv_c2j($str);
26 return $utf8->encode($jtext);
34 my $target = shift @_;
36 print STDERR "# checking '$target'\n";
37 opendir(my $dir, $target) || return $target;
38 my @entries = sort grep { !m/^(\.|\.\.)$/g } readdir($dir);
42 while (my $entry = shift @entries) {
43 if (my $japanese = match($entry)) {
44 print "mv '$target/$entry' \\\n";
45 print " '$target/$japanese'\n";
48 if (-d "$target/$entry") {
54 while (my $entry = pop @dirs) {
55 checkdir("$target/$entry");