9 my $top = shift @ARGV || exit;
10 if (! -d $top) { exit; }
12 my $utf8 = find_encoding("utf8");
19 my $sjis = encode("cp932", $utf8->decode($str), Encode::FB_HTMLCREF);
20 if ($sjis =~ /&#\d{4,};/) {
21 Encode::from_to($sjis, "cp932", "utf8");
29 my $target = shift @_;
31 print STDERR "# checking '$target'\n";
32 opendir(my $dir, $target) || return $target;
33 my @entries = sort grep { !m/^(\.|\.\.)$/g } readdir($dir);
37 while (my $entry = shift @entries) {
38 if (my $convert = match($entry)) {
39 print "'$target/$entry' can be converted to '$convert'\n";
42 if (-d "$target/$entry") {
48 while (my $entry = pop @dirs) {
49 checkdir("$target/$entry");