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

Whitespace and '&nbsp'

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
May 26, 2011, 21:12 UTC
Message-ID
<BANLkTik7eJ=BC9Bekqu-W1-r0cheCjC+wg@mail.gmail.com>

So I just got a patch that had a hidden &nbsp in it (unicode: u00a0, utf-8: \0302\0240) and sad to say my terminal window shows no indication of that what-so-ever. It looks exactly like a regular space, except gcc won't actually accept it.

So I'm wondering whether git shouldn't be escaping things like that in diffs, for example. Looking at binary noise (using "git diff --text"), I notice we have other things that don't get escaped either, although at least then "less" will escape it for us. Again, for &nbsp, less doesn't show it any different than a regular space either.

Yeah, I'm sure there is some programming font out there that makes it visible, but I do wonder whether git should help.

I even used "--whitespace=fix" to apply the patch, but git doesn't even recognize the thing as whitespace, so that didn't make any real difference.

                          Linus
Next: Junio C Hamano
Message 1 of 15 in “Whitespace and '&nbsp'”
  1. Linus TorvaldsMay 26, 2011
  2. Junio C HamanoMay 26, 2011
  3. Linus TorvaldsMay 26, 2011
  4. Andreas SchwabMay 27, 2011
  5. Linus TorvaldsMay 27, 2011
  6. Junio C HamanoMay 27, 2011
  7. Junio C HamanoMay 27, 2011
  8. Linus TorvaldsMay 27, 2011
  9. Junio C HamanoMay 27, 2011
  10. 1/3 ws.c: add a helper to format comma separated messagesJunio C Hamano, May 27, 2011
  11. 2/3 War on nbsp: a bit of retreatJunio C Hamano, May 27, 2011
  12. 3/3 War on nbsp: Add "nbsp" whitespace breakage classJunio C Hamano, May 27, 2011
  13. 4/3 War on nbsp: teach "git apply" to check and fix nbspJunio C Hamano, May 28, 2011
  14. Daniel NyströmMay 30, 2011
  15. Matthieu MoyMay 26, 2011

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.