ウェブログ記事を収集していると,意図しない文字が 混入してしまい,文字化けしてしまうことがあります. そうした文字化けの原因を探るためのPerlスクリプトを 書いてみました. #!/usr/local/bin/perl use Data::Dumper; use Unicode::UCD qw/charinfo charblock/; my $file = shift; # ファイル名を引数に取る my $text; { local $/; open(IN, "<:utf8", $file); # 入力ファイルはUTF-8とする $text = <IN>; close(IN); } my $len = length($text); # 1文字ずつループさせる for(my $i = 0; $i < $len; $i++) { my $char = substr($text, $i, 1);