{"thread":{"id":"18882","subject":"[PATCH] Use &#160; instead of &nbsp; for XHTML compliance","startedAt":"2009-04-15T15:40:12Z","lastAt":"2009-04-15T16:38:29Z","messageCount":5,"participants":["Todd Zullinger","Mike Hommey","Jakub Narebski","Ricky Zhou"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"111363","messageId":"20090415154012.GX13966@inocybe.teonanacatl.org","threadId":"18882","inReplyTo":null,"subject":"[PATCH] Use &#160; instead of &nbsp; for XHTML compliance","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2009-04-15T15:40:12Z","receivedAt":"2009-04-15T15:40:12Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"From: Ricky Zhou <ricky@fedoraproject.org>\n---\n\nThis was noticed by the Fedora Infrastructure folks.  The pages\nrendered fine in Firefox, but caused an XML error when run through tor\nand privoxy together.  Part of this problem description may belong in\nthe commit message -- I was hesitant to add it, as I didn't read all\nof the IRC log where the problem was noticed and debugged.\n\n gitweb/gitweb.perl |   40 ++++++++++++++++++++--------------------\n 1 files changed, 20 insertions(+), 20 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 33ef190..55b56f7 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1042,8 +1042,8 @@ sub esc_html ($;%) {\n \n \t$str = to_utf8($str);\n \t$str = $cgi->escapeHTML($str);\n-\tif ($opts{'-nbsp'}) {\n-\t\t$str =~ s/ /&nbsp;/g;\n+\tif ($opts{'-subspaces'}) {\n+\t\t$str =~ s/ /&#160;/g;\n \t}\n \t$str =~ s|([[:cntrl:]])|(($1 ne \"\\t\") ? quot_cec($1) : $1)|eg;\n \treturn $str;\n@@ -1056,8 +1056,8 @@ sub esc_path {\n \n \t$str = to_utf8($str);\n \t$str = $cgi->escapeHTML($str);\n-\tif ($opts{'-nbsp'}) {\n-\t\t$str =~ s/ /&nbsp;/g;\n+\tif ($opts{'-subspaces'}) {\n+\t\t$str =~ s/ /&#160;/g;\n \t}\n \t$str =~ s|([[:cntrl:]])|quot_cec($1)|eg;\n \treturn $str;\n@@ -1383,7 +1383,7 @@ sub file_type_long {\n sub format_log_line_html {\n \tmy $line = shift;\n \n-\t$line = esc_html($line, -nbsp=>1);\n+\t$line = esc_html($line, -subspaces=>1);\n \t$line =~ s{\\b([0-9a-fA-F]{8,40})\\b}{\n \t\t$cgi->a({-href => href(action=>\"object\", hash=>$1),\n \t\t\t\t\t-class => \"text\"}, $1);\n@@ -1710,7 +1710,7 @@ sub format_diff_line {\n \t\t\t                     -class=>\"list\"}, $to_text);\n \t\t}\n \t\t$line = \"<span class=\\\"chunk_info\\\">@@ $from_text $to_text @@</span>\" .\n-\t\t        \"<span class=\\\"section\\\">\" . esc_html($section, -nbsp=>1) . \"</span>\";\n+\t\t        \"<span class=\\\"section\\\">\" . esc_html($section, -subspaces=>1) . \"</span>\";\n \t\treturn \"<div class=\\\"diff$diff_class\\\">$line</div>\\n\";\n \t} elsif ($from && $to && $line =~ m/^\\@{3}/) {\n \t\tmy ($prefix, $ranges, $section) = $line =~ m/^(\\@+) (.*?) \\@+(.*)$/;\n@@ -1743,10 +1743,10 @@ sub format_diff_line {\n \t\t\t$line .= $to_text;\n \t\t}\n \t\t$line .= \" $prefix</span>\" .\n-\t\t         \"<span class=\\\"section\\\">\" . esc_html($section, -nbsp=>1) . \"</span>\";\n+\t\t         \"<span class=\\\"section\\\">\" . esc_html($section, -subspaces=>1) . \"</span>\";\n \t\treturn \"<div class=\\\"diff$diff_class\\\">$line</div>\\n\";\n \t}\n-\treturn \"<div class=\\\"diff$diff_class\\\">\" . esc_html($line, -nbsp=>1) . \"</div>\\n\";\n+\treturn \"<div class=\\\"diff$diff_class\\\">\" . esc_html($line, -subspaces=>1) . \"</div>\\n\";\n }\n \n # Generates undef or something like \"_snapshot_\" or \"snapshot (_tbz2_ _zip_)\",\n@@ -2101,9 +2101,9 @@ sub git_populate_project_tagcloud {\n \t\t\t# Pad the title with spaces so that the cloud looks\n \t\t\t# less crammed.\n \t\t\tmy $title = $ctags_lc{$_}->{topname};\n-\t\t\t$title =~ s/ /&nbsp;/g;\n-\t\t\t$title =~ s/^/&nbsp;/g;\n-\t\t\t$title =~ s/$/&nbsp;/g;\n+\t\t\t$title =~ s/ /&#160;/g;\n+\t\t\t$title =~ s/^/&#160;/g;\n+\t\t\t$title =~ s/$/&#160;/g;\n \t\t\t$cloud->add($title, $home_link.\"?by_tag=\".$_, $ctags_lc{$_}->{count});\n \t\t}\n \t} else {\n@@ -3535,7 +3535,7 @@ sub git_difftree_body {\n \t\t\t               -title => 'commitdiff to parent number ' .\n \t\t\t                          ($i+1) . ': ' . substr($par,0,7)},\n \t\t\t              $i+1) .\n-\t\t\t      \"&nbsp;</th>\\n\";\n+\t\t\t      \"&#160;</th>\\n\";\n \t\t}\n \t\tprint \"</tr></thead>\\n<tbody>\\n\";\n \t}\n@@ -4275,7 +4275,7 @@ sub git_tags_body {\n \t\tif ($tag{'type'} eq \"tag\") {\n \t\t\tprint $cgi->a({-href => href(action=>\"tag\", hash=>$tag{'id'})}, \"tag\");\n \t\t} else {\n-\t\t\tprint \"&nbsp;\";\n+\t\t\tprint \"&#160;\";\n \t\t}\n \t\tprint \"</td>\\n\" .\n \t\t      \"<td class=\\\"link\\\">\" . \" | \" .\n@@ -4491,7 +4491,7 @@ sub git_summary {\n \tgit_header_html();\n \tgit_print_page_nav('summary','', $head);\n \n-\tprint \"<div class=\\\"title\\\">&nbsp;</div>\\n\";\n+\tprint \"<div class=\\\"title\\\">&#160;</div>\\n\";\n \tprint \"<table class=\\\"projects_list\\\">\\n\" .\n \t      \"<tr id=\\\"metadata_desc\\\"><td>description</td><td>\" . esc_html($descr) . \"</td></tr>\\n\" .\n \t      \"<tr id=\\\"metadata_owner\\\"><td>owner</td><td>\" . esc_html($owner) . \"</td></tr>\\n\";\n@@ -4602,7 +4602,7 @@ sub git_tag {\n \tmy $comment = $tag{'comment'};\n \tforeach my $line (@$comment) {\n \t\tchomp $line;\n-\t\tprint esc_html($line, -nbsp=>1) . \"<br/>\\n\";\n+\t\tprint esc_html($line, -subspaces=>1) . \"<br/>\\n\";\n \t}\n \tprint \"</div>\\n\";\n \tgit_footer_html();\n@@ -4888,7 +4888,7 @@ sub git_blob {\n \t\t\t$nr++;\n \t\t\t$line = untabify($line);\n \t\t\tprintf \"<div class=\\\"pre\\\"><a id=\\\"l%i\\\" href=\\\"#l%i\\\" class=\\\"linenr\\\">%4i</a> %s</div>\\n\",\n-\t\t\t       $nr, $nr, $nr, esc_html($line, -nbsp=>1);\n+\t\t\t       $nr, $nr, $nr, esc_html($line, -subspaces=>1);\n \t\t}\n \t}\n \tclose $fd\n@@ -5913,13 +5913,13 @@ sub git_search {\n \t\t\t} else {\n \t\t\t\t$ltext = untabify($ltext);\n \t\t\t\tif ($ltext =~ m/^(.*)($search_regexp)(.*)$/i) {\n-\t\t\t\t\t$ltext = esc_html($1, -nbsp=>1);\n+\t\t\t\t\t$ltext = esc_html($1, -subspaces=>1);\n \t\t\t\t\t$ltext .= '<span class=\"match\">';\n-\t\t\t\t\t$ltext .= esc_html($2, -nbsp=>1);\n+\t\t\t\t\t$ltext .= esc_html($2, -subspaces=>1);\n \t\t\t\t\t$ltext .= '</span>';\n-\t\t\t\t\t$ltext .= esc_html($3, -nbsp=>1);\n+\t\t\t\t\t$ltext .= esc_html($3, -subspaces=>1);\n \t\t\t\t} else {\n-\t\t\t\t\t$ltext = esc_html($ltext, -nbsp=>1);\n+\t\t\t\t\t$ltext = esc_html($ltext, -subspaces=>1);\n \t\t\t\t}\n \t\t\t\tprint \"<div class=\\\"pre\\\">\" .\n \t\t\t\t\t$cgi->a({-href => href(action=>\"blob\", hash=>$co{'hash'},\n-- \n1.6.0.6\n\n-- \nTodd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nTo have a successful relationship, I must learn to make it look like\nI'm giving as much as I'm getting.\n"},{"id":"111364","messageId":"20090415155013.GA15518@glandium.org","threadId":"18882","inReplyTo":"20090415154012.GX13966@inocybe.teonanacatl.org","subject":"Re: [PATCH] Use &#160; instead of &nbsp; for XHTML compliance","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2009-04-15T15:50:14Z","receivedAt":"2009-04-15T15:50:14Z","isPatch":true,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"On Wed, Apr 15, 2009 at 11:40:12AM -0400, Todd Zullinger <tmz@pobox.com> wrote:\n> From: Ricky Zhou <ricky@fedoraproject.org>\n> ---\n> \n> This was noticed by the Fedora Infrastructure folks.  The pages\n> rendered fine in Firefox, but caused an XML error when run through tor\n> and privoxy together.  Part of this problem description may belong in\n> the commit message -- I was hesitant to add it, as I didn't read all\n> of the IRC log where the problem was noticed and debugged.\n\n&nbsp; is very much xhtml compliant, so the problem must lie somewhere\nelse, possibly in privoxy.\n\nMike\n"},{"id":"111365","messageId":"200904151755.07425.jnareb@gmail.com","threadId":"18882","inReplyTo":"20090415154012.GX13966@inocybe.teonanacatl.org","subject":"Re: [PATCH] Use &#160; instead of &nbsp; for XHTML compliance","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-04-15T15:55:04Z","receivedAt":"2009-04-15T15:55:04Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Wed, 15 April 2009, Todd Zullinger wrote:\n\n> From: Ricky Zhou <ricky@fedoraproject.org>\n> ---\n> \n> This was noticed by the Fedora Infrastructure folks.  The pages\n> rendered fine in Firefox, but caused an XML error when run through tor\n> and privoxy together.  Part of this problem description may belong in\n> the commit message -- I was hesitant to add it, as I didn't read all\n> of the IRC log where the problem was noticed and debugged.\n\nWouldn't it be a better solution to add DTD with HTML entities if/when\ngitweb serves XHTML 1.0 together application/xhtml+xml mimetype, instead\nof unconditionally using what is I think worse solution? Especially that\nerror is I think quite rare situation and/or bug in browser...\n\nI also don't think that the change -nbsp => -subspaces is necessary;\nit causes large code churn for nothing, and name is IMVHO worse.\nIt is about nonbreakable and non-compactable space.\n\n> \n>  gitweb/gitweb.perl |   40 ++++++++++++++++++++--------------------\n>  1 files changed, 20 insertions(+), 20 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 33ef190..55b56f7 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -1042,8 +1042,8 @@ sub esc_html ($;%) {\n>  \n>  \t$str = to_utf8($str);\n>  \t$str = $cgi->escapeHTML($str);\n> -\tif ($opts{'-nbsp'}) {\n> -\t\t$str =~ s/ /&nbsp;/g;\n> +\tif ($opts{'-subspaces'}) {\n> +\t\t$str =~ s/ /&#160;/g;\n>  \t}\n>  \t$str =~ s|([[:cntrl:]])|(($1 ne \"\\t\") ? quot_cec($1) : $1)|eg;\n>  \treturn $str;\n\n-- \nJakub Narebski\nPoland\n"},{"id":"111371","messageId":"20090415162123.GC3316@sphe.res.cmu.edu","threadId":"18882","inReplyTo":"200904151755.07425.jnareb@gmail.com","subject":"Re: [PATCH] Use &#160; instead of &nbsp; for XHTML compliance","fromName":"Ricky Zhou","fromEmail":"ricky@fedoraproject.org","sentAt":"2009-04-15T16:21:23Z","receivedAt":"2009-04-15T16:21:23Z","isPatch":true,"sender":{"key":"ricky@fedoraproject.org","avatar":null},"body":"On 2009-04-15 05:55:04 PM, Jakub Narebski wrote:\n> Wouldn't it be a better solution to add DTD with HTML entities if/when\n> gitweb serves XHTML 1.0 together application/xhtml+xml mimetype, instead\n> of unconditionally using what is I think worse solution? Especially that\n> error is I think quite rare situation and/or bug in browser...\n> \n> I also don't think that the change -nbsp => -subspaces is necessary;\n> it causes large code churn for nothing, and name is IMVHO worse.\n> It is about nonbreakable and non-compactable space.\nSorry, as Mike mentioned, I was mistaken about the validity of &nbsp;.\nI'm going to try to reproduce this myself so I can look more into what\nactually caused the error.\n\nThanks,\nRicky\n"},{"id":"111372","messageId":"20090415163829.GD3316@sphe.res.cmu.edu","threadId":"18882","inReplyTo":"20090415155013.GA15518@glandium.org","subject":"Re: [PATCH] Use &#160; instead of &nbsp; for XHTML compliance","fromName":"Ricky Zhou","fromEmail":"ricky@fedoraproject.org","sentAt":"2009-04-15T16:38:29Z","receivedAt":"2009-04-15T16:38:29Z","isPatch":true,"sender":{"key":"ricky@fedoraproject.org","avatar":null},"body":"On 2009-04-15 05:50:14 PM, Mike Hommey wrote:\n> &nbsp; is very much xhtml compliant, so the problem must lie somewhere\n> else, possibly in privoxy.\nSorry for the noise, I've confirmed that this only happens with\ntorbutton is used.  \n\nThanks,\nRicky\n"}]}