6 use Encode qw(from_to);
7 use charnames qw(greek);
8 my @encodings = grep(/iso8859/,Encode::encodings());
10 plan test => 13+$n*@encodings;
11 my $str = join('',map(chr($_),0x20..0x7E));
13 ok(length($str),from_to($cpy,'iso8859-1','Unicode'),"Length Wrong");
14 ok($cpy,$str,"ASCII mangled by translating from iso8859-1 to Unicode");
16 ok(from_to($cpy,'Unicode','iso8859-1'),length($str),"Length wrong");
17 ok($cpy,$str,"ASCII mangled by translating from Unicode to iso8859-1");
19 $str = join('',map(chr($_),0xa0..0xff));
21 ok(length($str),from_to($cpy,'iso8859-1','Unicode'),"Length Wrong");
23 my $sym = Encode->getEncoding('symbol');
24 my $uni = $sym->toUnicode('a');
25 ok("\N{alpha}",substr($uni,0,1),"alpha does not map so symbol 'a'");
26 $str = $sym->fromUnicode("\N{Beta}");
27 ok("B",substr($str,0,1),"Symbol 'B' does not map to Beta");
29 foreach my $enc (qw(symbol dingbats ascii),@encodings)
31 my $tab = Encode->getEncoding($enc);
32 ok(1,defined($tab),"Could not load $enc");
33 $str = join('',map(chr($_),0x20..0x7E));
34 $uni = $tab->toUnicode($str);
35 $cpy = $tab->fromUnicode($uni);
36 ok($cpy,$str,"$enc mangled translating to Unicode and back");