diff options
author | Karl Williamson <khw@khw-desktop.(none)> | 2009-11-20 17:14:30 -0700 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2009-11-23 11:43:32 +0100 |
commit | 1cfccccd91dcb8384e07fecd6d80c2f1956492ac (patch) | |
tree | 63c5899fc1b4b92c6502118a6c02009c56eed68d /t/test.pl | |
parent | 02b203e04b3608f934ad6d2d29e54f3c318addb8 (diff) | |
download | perl-1cfccccd91dcb8384e07fecd6d80c2f1956492ac.tar.gz |
Use hex instead of octal for larger code points
Diffstat (limited to 't/test.pl')
-rw-r--r-- | t/test.pl | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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; } } |