* fix: convert non Shift_JIS character only
[lab.git] / misc / findsimplified.pl
index 024e4cc..bb80414 100755 (executable)
@@ -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 '';