From: mitty Date: Fri, 25 Jan 2013 17:18:36 +0000 (+0000) Subject: * fix: convert non Shift_JIS character only X-Git-Url: http://lab.mitty.jp/git/?a=commitdiff_plain;h=8d17d4e812ac296d7e1697c18a2bf8e4a03ad823;p=lab.git * fix: convert non Shift_JIS character only * skip needless convert (such as U+8C37 -> U+7A40) git-svn-id: https://lab.mitty.jp/svn/lab/trunk@199 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- diff --git a/misc/findsimplified.pl b/misc/findsimplified.pl index 024e4cc..bb80414 100755 --- a/misc/findsimplified.pl +++ b/misc/findsimplified.pl @@ -19,9 +19,12 @@ sub match { my $str = shift @_; $str = $utf8->decode($str); - my $jtext = $ck->conv_c2j($str); - if ($str ne $jtext) { - return $utf8->encode($jtext); + my $sjis = encode("cp932", $str, Encode::FB_HTMLCREF); + if ($sjis =~ /&#\d{4,};/) { + my $jtext = $ck->conv_c2j($str); + if ($str ne $jtext) { + return $utf8->encode($jtext); + } } return '';