From: mitty Date: Fri, 25 Jan 2013 16:38:41 +0000 (+0000) Subject: * output string contains numeric character references X-Git-Url: http://lab.mitty.jp/git/?a=commitdiff_plain;h=bf1a1eab8ab75f495c2d81fae907bed6a071ffae;p=lab.git * output string contains numeric character references git-svn-id: https://lab.mitty.jp/svn/lab/trunk@197 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- diff --git a/misc/findnonsjis.pl b/misc/findnonsjis.pl index 1ae7aef..71e9a0a 100755 --- a/misc/findnonsjis.pl +++ b/misc/findnonsjis.pl @@ -18,7 +18,8 @@ sub match { my $sjis = encode("cp932", $utf8->decode($str), Encode::FB_HTMLCREF); if ($sjis =~ /&#\d{4,};/) { - return 1; + Encode::from_to($sjis, "cp932", "utf8"); + return $sjis; } return ''; @@ -34,8 +35,8 @@ sub checkdir { my @dirs; while (my $entry = shift @entries) { - if (match($entry)) { - print "'$target/$entry' contains non Shift_JIS character\n"; + if (my $convert = match($entry)) { + print "'$target/$entry' can be converted to '$convert'\n"; next; } if (-d "$target/$entry") {