1use strict; 2use warnings; 3 4use Encode; 5use Test::More; 6 7my $content = String->new("--\x{30c6}--"); 8my $text = Encode::encode('latin1', $content, Encode::FB_XMLCREF); 9is $text, "--テ--"; 10 11done_testing; 12 13package String; 14use overload 15 '""' => sub { ${$_[0]} }, fallback => 1; 16 17sub new { 18 my($class, $str) = @_; 19 bless \$str, $class; 20} 21 221; 23