エンコード関連
guess_encodingをちゃんと使ってなかったので。。
#!/usr/local/bin/perl -w use strict; #use utf8; use Encode qw/ decode encode from_to /; use Encode::Guess qw/ shiftjis 7bit-jis /; my $str = shift || 'UTF-8:ゆーてぃーえふえいと'; my $decoder = guess_encoding($str); print $decoder->name ." : ". $str ."\n\n"; from_to($str, $decoder->name, 'shiftjis'); $decoder = guess_encoding($str); print $decoder->name ." : ". $str ."\n\n"; my $tmp = ''; $tmp .= $str; $str = "文字コード\n"; $tmp .= $str; from_to($str, 'UTF-8', 'shiftjis'); $tmp .= $str; print $tmp ."\n\n";