gitweb: Quote non-displayable characters in hex, not octal
authorPetr Baudis <pasky@suse.cz>
Wed, 1 Oct 2008 20:11:54 +0000 (22:11 +0200)
committerShawn O. Pearce <spearce@spearce.org>
Fri, 3 Oct 2008 00:16:50 +0000 (17:16 -0700)
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 <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
gitweb/gitweb.perl
index 18e70a366333fffbadd37a7fbe509b4c33f9421f..eb2943a530189325407d83d12f22ca3494524866 100755 (executable)
@@ -775,7 +775,7 @@ sub quot_cec {
        );
        my $chr = ( (exists $es{$cntrl})
                    ? $es{$cntrl}
-                   : sprintf('\%03o', ord($cntrl)) );
+                   : sprintf('\%2x', ord($cntrl)) );
        if ($opts{-nohtml}) {
                return $chr;
        } else {