use Unicode::String; my $string = "This is a test\n"; my $u = Unicode::String->new($string); # print as something more human-readable print $u->utf8;