git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitweb: Quote non-displayable characters in hex, not octal

From
Petr Baudis <pasky@suse.cz>
Date
Oct 1, 2008, 20:11 UTC
Message-ID
<1222891914-24012-1-git-send-email-pasky@suse.cz>

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>
---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index da474d0..1b5aa14 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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 {
-- 
tg: (c427559..) t/misc/quot-hex (depends on: vanilla/master)
Message 1 of 1 in “gitweb: Quote non-displayable characters in hex, not octal”
  1. gitweb: Quote non-displayable characters in hex, not octalPetr Baudis, Oct 1, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.