1BEGIN { 2 if ( $] < 5.009 ) { 3 print "1..0 # Skip: Perl <= 5.9 or later required\n"; 4 exit 0; 5 } 6} 7use strict; 8use warnings; 9 10use Encode; 11use Test::More; 12 13my $content = String->new("--\x{30c6}--"); 14my $text = Encode::encode('latin1', $content, Encode::FB_XMLCREF); 15is $text, "--テ--"; 16 17done_testing(); 18 19package String; 20use overload 21 '""' => sub { ${$_[0]} }, fallback => 1; 22 23sub new { 24 my($class, $str) = @_; 25 bless \$str, $class; 26} 27 281; 29