1use strict; 2use warnings; 3use Encode; 4use Encode::JP::Mobile; 5use Test::More; 6 7my $sjis = "\x81\x60"; 8my @tildes = qw/FF5E 301C/; 9my @sjis_encodings = qw/x-sjis-docomo x-sjis-kddi-cp932-raw x-sjis-kddi-auto x-sjis-vodafone x-sjis-vodafone-auto x-sjis-airh/; 10my @utf8_encodings = qw/x-utf8-docomo x-utf8-kddi x-utf8-vodafone/; 11 12plan tests => @sjis_encodings*@tildes + @utf8_encodings*@tildes*2; 13 14for my $encoding (@sjis_encodings) { 15 for my $char (@tildes) { 16 is encode($encoding, chr hex $char), $sjis, "U+$char $encoding"; 17 } 18} 19 20for my $encoding (@utf8_encodings) { 21 for my $char (@tildes) { 22 is encode($encoding, chr hex $char), encode('utf8', chr hex $char), "U+$char $encoding"; 23 is decode($encoding, encode($encoding, chr hex $char)), chr hex $char, "U+$char $encoding(roundtrip safe)"; 24 } 25} 26 27