Use hex instead of octal for larger code points
Karl Williamson [Sat, 21 Nov 2009 00:14:30 +0000 (17:14 -0700)]
t/test.pl

index 7d1a90b..bb27794 100644 (file)
--- a/t/test.pl
+++ b/t/test.pl
@@ -158,7 +158,16 @@ sub display {
                     $y = $y . $backslash_escape{$c};
                 } else {
                     my $z = chr $c; # Maybe we can get away with a literal...
-                    $z = sprintf "\\%03o", $c if $z =~ /[[:^print:]]/;
+                    if ($z =~ /[[:^print:]]/) {
+
+                        # Use octal for characters traditionally expressed as
+                        # such: the low controls
+                        if ($c <= 037) {
+                            $z = sprintf "\\%03o", $c;
+                        } else {
+                            $z = sprintf "\\x{%x}", $c;
+                        }
+                    }
                     $y = $y . $z;
                 }
             }