my $encoded = encode_entities($line); print "$encoded\n"; #### a #### my $text; { open my $fh, '<:utf8', 'utf8.txt'; $text = <$fh>; close $fh; } my $encoded = encode_entities($text); print "$encoded\n"; #### “a”
## a ##
## my $text; { open my $fh, '<:utf8', 'utf8.txt'; $text = <$fh>; close $fh; } my $encoded = encode_entities($text); print "$encoded\n"; ##
## “a”