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

Re: [PATCH] Try URI quoting for embedded TAB and LF in pathnames

From
Linus Torvalds <torvalds@osdl.org>
Date
Oct 12, 2005, 21:05 UTC
Message-ID
<Pine.LNX.4.64.0510121355280.15297@g5.osdl.org>
In-Reply-To
<87vf02qy79.fsf@penguin.cs.ucla.edu>
On Wed, 12 Oct 2005, Paul Eggert wrote:
> 
> Your email message suggests that we need to be cautious here.
> That message contained UTF-8 text but its header said "Content-Type:
> TEXT/PLAIN; charset=ISO-8859-1".

Well, my email message was wrong and evil, because it _mixed_ two different encodings in the same text. No sane client could have shown them both at the same time - but especially with a stupid client, you could have changed your terminal to show either one or the other by switching from utf-8 to latin1 encoding and doing a refresh.

In other words, my email really was a nasty case of not one or the other, but both.

Now, I believe patches can actually be that way - it's not at all impossible to have a diff where the _filename_ is utf-8, but the content of the patch itself is some byte-encoding like latin1. Or the other way around.

> If we're still having problems like this in 2005 then I guess we need
> to deal with them.  This suggests we should be escaping every
> non-ASCII byte, at least for patches designed to be emailed robustly.

I find that email is very robust - it's basically 8-bit clean. No character encoding, no crap. Just a byte stream. It really _is_ the most reliable format.

Now, a lot of email clients are really weak in _showing_ it, and as mentioned, the email that mixed both is fundamentally not something you really even _can_ show sanely. But who cares? What matters is not what it looks like, but what it _saves_ as. If you save the email message, it should come out as the same reliable 8-bit byte stream, or your client is actively corrupting messages rather than just showing them.

This is really what my argument boils down to: character set encoding should _not_ EVER affect the _transfer_ of the data. It doesn't matter if something is latin1 or utf-8, the only thing that matters is the byte sequence. Only when you _display_ it should you try to figure out what the byte sequence possibly means.

So I repeat: 
 - escape as little as possible
 - make the _viewer_ decide how to view it.

Yes, if people use "cat" to view patches, it can be dangerous. But that's _their_ problem.

		Linus
Previous: Junio C HamanoNext: H. Peter Anvin
Message 23 of 33 in “[RFC] embedded TAB and LF in pathnames”
  1. Junio C HamanoOct 7, 2005
  2. Alex RiesenOct 7, 2005
  3. Junio C HamanoOct 7, 2005
  4. Alex RiesenOct 8, 2005
  5. Junio C HamanoOct 8, 2005
  6. Try URI quoting for embedded TAB and LF in pathnamesRobert Fitzsimons, Oct 8, 2005
  7. Junio C HamanoOct 8, 2005
  8. Junio C HamanoOct 8, 2005
  9. Paul EggertOct 11, 2005
  10. Junio C HamanoOct 11, 2005
  11. Linus TorvaldsOct 11, 2005
  12. Paul EggertOct 11, 2005
  13. Linus TorvaldsOct 11, 2005
  14. Paul EggertOct 11, 2005
  15. Linus TorvaldsOct 11, 2005
  16. Paul EggertOct 12, 2005
  17. Linus TorvaldsOct 12, 2005
  18. Daniel BarkalowOct 12, 2005
  19. Linus TorvaldsOct 12, 2005
  20. H. Peter AnvinOct 12, 2005
  21. Junio C HamanoOct 9, 2005
  22. Junio C HamanoOct 12, 2005
  23. Linus TorvaldsOct 12, 2005
  24. H. Peter AnvinOct 12, 2005
  25. Johannes SchindelinOct 12, 2005
  26. Junio C HamanoOct 12, 2005
  27. Paul EggertOct 14, 2005
  28. Linus TorvaldsOct 14, 2005
  29. Linus TorvaldsOct 12, 2005
  30. Paul EggertOct 14, 2005
  31. Linus TorvaldsOct 14, 2005
  32. H. Peter AnvinOct 14, 2005
  33. Junio C HamanoOct 14, 2005

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.