use charnames (); sub escape_str { my $str = shift; $str =~ s{([^\0-\177])}{_N_escape($1)}eg; return $str; } sub _N_escape { return '\N{' . charnames::viacode(ord($_[0])) . '}'; } #### sub _print_diag { my $self = shift; local($\, $", $,) = (undef, ' ', ''); my $fh = $self->todo ? $self->todo_output : $self->failure_output; print $fh @_; } #### $ perl -MTest::More -wle 'binmode Test::More->builder->failure_output, ":utf8"; diag chr(228)' # ä