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

Re: Rss produced by git is not valid xml?

From
Linus Torvalds <torvalds@osdl.org>
Date
Nov 18, 2005, 20:47 UTC
Message-ID
<Pine.LNX.4.64.0511181237040.13959@g5.osdl.org>
In-Reply-To
<437E3971.3060803@zytor.com>
On Fri, 18 Nov 2005, H. Peter Anvin wrote:
> 
> I think the point is: what do you do with the data?  If it *looks* like valid
> UTF-8, you pretty much have to assume it is; if it's not (it contains invalid
> UTF-8 sequences), what do you do?
Btw, this is not a new issue.

This is true even of data that _claims_ to be UTF-8 but contains sequences that are illegal. A program that just barfs on it is a buggy program.

And yes, I know there are buggy programs out there. I seem to recall some perl(?) problems when it got UTF-8 strings that weren't, and did impossible things.

> There are only a small handful of alternatives, and none are really good:
> 
> 	- Reject it (it's kind of too late, should have been done at
> 	  checkin)
It can't be done at checkin, since it's not _wrong_. It's 8-bit data. 

It's like saying that /bin/echo is an illegal program and shouldn't be executed, because it's not encoded in utf-8.

I can well imagine somebody wanting to put a binary signature at the end of a commit. git shouldn't care, and the important thing to realize is that there _is_ no "encoding" for such things. So the commits don't necessarily have to have a font encoding at all, and any visualization tool should just accept that fact.

Show 5 quoted lines
> 	- Show them as SUBSTITUTE characters (U+FFFD).
> 	- Show them as Latin-1 or Windows-1252
> 	- Provide a complex configuration mechanism
> 
> I think Kay is going with the second option.

Which is a fine option. Latin-1 is probably the right choice for the kernel, but not necessarily for other projects.

Another option is to just pass them through unmodified, and encourage the XML parser to handle it. Anything that takes UTF-8 and doesn't have some fallback to handle malformed input is basically buggy. It simply _will_ happen occasionally, quite independently of git. You can either give up, or try to handle it. And giving up is always the wrong choice.

			Linus
Previous: H. Peter AnvinNext: H. Peter Anvin
Message 8 of 52 in “Rss produced by git is not valid xml?”
  1. Ismail DonmezNov 18, 2005
  2. Ismail DonmezNov 18, 2005
  3. Ismail DonmezNov 18, 2005
  4. Kay SieversNov 18, 2005
  5. Ismail DonmezNov 18, 2005
  6. Linus TorvaldsNov 18, 2005
  7. H. Peter AnvinNov 18, 2005
  8. Linus TorvaldsNov 18, 2005
  9. H. Peter AnvinNov 18, 2005
  10. Josef WeidendorferNov 18, 2005
  11. Kay SieversNov 18, 2005
  12. Ismail DonmezNov 18, 2005
  13. Linus TorvaldsNov 18, 2005
  14. Ismail DonmezNov 18, 2005
  15. Junio C HamanoNov 18, 2005
  16. Ismail DonmezNov 18, 2005
  17. Junio C HamanoNov 19, 2005
  18. Kay SieversNov 18, 2005
  19. Linus TorvaldsNov 18, 2005
  20. Ismail DonmezNov 18, 2005
  21. Linus TorvaldsNov 18, 2005
  22. H. Peter AnvinNov 18, 2005
  23. Linus TorvaldsNov 18, 2005
  24. H. Peter AnvinNov 18, 2005
  25. Andreas EricssonNov 18, 2005
  26. H. Peter AnvinNov 19, 2005
  27. Andreas EricssonNov 19, 2005
  28. Johannes SchindelinNov 19, 2005
  29. Linus TorvaldsNov 18, 2005
  30. H. Peter AnvinNov 18, 2005
  31. Johannes SchindelinNov 19, 2005
  32. Linus TorvaldsNov 18, 2005
  33. Johannes SchindelinNov 19, 2005
  34. Junio C HamanoNov 19, 2005
  35. Linus TorvaldsNov 19, 2005
  36. Junio C HamanoNov 19, 2005
  37. Linus TorvaldsNov 19, 2005
  38. Johannes SchindelinNov 20, 2005
  39. Linus TorvaldsNov 20, 2005
  40. Johannes SchindelinNov 20, 2005
  41. Johannes SchindelinNov 19, 2005
  42. H. Peter AnvinNov 20, 2005
  43. Johannes SchindelinNov 21, 2005
  44. H. Peter AnvinNov 21, 2005
  45. Junio C HamanoNov 19, 2005
  46. H. Peter AnvinNov 19, 2005
  47. Junio C HamanoNov 27, 2005
  48. Linus TorvaldsNov 27, 2005
  49. 2/3 mailinfo: allow -u to fall back on latin1 to utf8 conversion.Junio C Hamano, Nov 28, 2005
  50. H. Peter AnvinNov 28, 2005
  51. Junio C HamanoNov 28, 2005
  52. Kay SieversNov 27, 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.