]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Quote non-displayable characters in hex, not octal
authorPetr Baudis <redacted>
Wed, 1 Oct 2008 20:11:54 +0000 (22:11 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:34 +0000 (00:07 -0400)
For the last 30 years, the mankind uses the octal representation of
characters only in rare cases and most character codes are hardly
recognizable in octal. In contrast, many programmers still know
hexadecimal well and that is also the representation of choice e.g.
for Unicode codepoints.

Signed-off-by: Petr Baudis <redacted>
Signed-off-by: Shawn O. Pearce <redacted>
gitweb.perl

index 2efd43719c8785b23b96841ed7f997e3363be810f6b8030488cddc913808d705..5ac2233929773b7cf14348f23a1e2893372a5d9cbaae1f5aba77be68c2561fc4 100755 (executable)
@@ -776,7 +776,7 @@ sub quot_cec {
        );
        my $chr = ( (exists $es{$cntrl})
                    ? $es{$cntrl}
        );
        my $chr = ( (exists $es{$cntrl})
                    ? $es{$cntrl}
-                   : sprintf('\%03o', ord($cntrl)) );
+                   : sprintf('\%2x', ord($cntrl)) );
        if ($opts{-nohtml}) {
                return $chr;
        } else {
        if ($opts{-nohtml}) {
                return $chr;
        } else {
This page took 0.156645 seconds and 4 git commands to generate.