This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
APItest:t/utf8_setup.pl: Display printables as themselves
[perl5.git] / ext / XS-APItest / t / utf8_setup.pl
index ec7a5ce..231b4d9 100644 (file)
@@ -11,7 +11,11 @@ sub isASCII { ord "A" == 65 }
 sub display_bytes_no_quotes {
     use bytes;
     my $string = shift;
-    return join("", map { sprintf("\\x%02x", ord $_) } split "", $string)
+    return join("", map {
+                          ($_ =~ /[[:print:]]/)
+                          ? $_
+                          : sprintf("\\x%02x", ord $_)
+                        } split "", $string)
 }
 
 sub display_bytes {