Re: [PATCH 2/n] gitweb: Use '&iquot;' instead of '?' in esc_path
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Nov 3, 2006, 16:19 UTC
- Message-ID
- <200611031719.13073.jnareb@gmail.com>
- In-Reply-To
- <7vvem1s29g.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 22 quoted lines
>
> Junio C Hamano <junkio@cox.net> writes:
>
>> Jakub Narebski <jnareb@gmail.com> writes:
>>
>>> Use "&iquot;" Latin 1 entity ("¿" -- inverted question mark =
>>> turned question mark, U+00BF ISOnum) instead '?' as replacements for
>>> control characters and other undisplayable characters.
>>>
>>> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
>>
>> Do you have something against our Spanish and Latin American
>> friends? ;-)
>>
>> I wonder if there is a more suitable replacement character that
>> is accepted across scripts?
>
> I have a suspicion that instead of finding an exotic character,
> just showing the byte value in \octal, perhaps in different
> color, might be more portable and easier. For one thing, it
> helps to show the exact byte value than just one substitution
> character if you are troubleshooting gitweb.
Or perhaps we can use Unicode Control Pictures U+2400 – U+243F
(9216–9279) ("Unicode quoting"):http://www.alanwood.net/unicode/control_pictures.html http://www.unicode.org/charts/PDF/U2400.pdf
# quote unsafe characters and escape filename to HTML
sub esc_path {
my $str = shift;
$str = esc_html($str);
$str =~ s!([[:cntrl:]])!sprintf('<span class="cntrl">&#%04d;</span>', 9216+ord($1))!eg;
return $str;
}with perhaps the following CSS
span.cntrl {
border: dashed #aaaaaa;
border-width: 1px;
padding: 0px 2px 0px 2px;
margin: 0px 2px 0px 2px;
}What do you think of it?
-- Jakub Narebski