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:24 UTC
Message-ID
<Pine.LNX.4.64.0510121411550.15297@g5.osdl.org>
In-Reply-To
<87vf02qy79.fsf@penguin.cs.ucla.edu>
On Wed, 12 Oct 2005, Paul Eggert wrote:
Show 5 quoted lines
> 
> Worse, when I used Emacs to copy your text into another file -- the
> sort of thing that is likely to be done with an emailed patch -- the
> file contained the UTF-8 encoding of the gibberish, rather than the
> original bytes of your message.

Btw, this is an example of where locale-based character translations just fundamentally suck.

cut-and-paste quote naturally tries to translate between the source and destination locales, but it fundamentally cannot work. The only thing that ever works is bit-for-bit copying.

Any program that tries to do locale conversion is always going to be a bug waiting to happen.

If GNU emacs does locale translations rather than just do a binary transfer of the data, then that's a sign that GNU emavs is being really stupid. If the data was UTF-8 to begin with, then a binary copy is also going to be UTF-8. And if it wasn't UTF-8, then a binary copy is the only thing that is sensible.

And this is the thing that makes UTF-8 so wonderful: exactly the fact that it makes bit-for-bit copying an acceptable policy again, and locales become a non-issue. In a truly UTF-8 world, you should _never_ convert anything at all (and that includes mis-formed UTF-8).

Any non-binary file saving or transfer approach where characters have "meaning" is always mistake. It's why DOS/Windows "binary" vs "text" files was wrong. It's why font-encoding locales are wrong (Mixed text with two types? Yet another metadata quoting scheme? No thank you! It's also why UCS-16 and UCS-32 were total disasters: they had "context" in their encoding).

Say "yes" to binary transfer. Because text transfers are broken.
			Linus
Previous: Linus TorvaldsNext: Paul Eggert
Message 29 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.