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

Re: gitweb forgets to send utf8 header for raw blob views

From
LWLea Wiemann <lewiemann@gmail.com>
Date
May 29, 2008, 11:32 UTC
Message-ID
<483E9468.1090300@gmail.com>
In-Reply-To
<alpine.LNX.1.10.0805282002510.19264@fbirervta.pbzchgretzou.qr>
Jan Engelhardt wrote:
> [utf8 does not work] for raw blob views like
> http://dev.medozas.de/gitweb.cgi?p=hxtools;a=blob_plain;f=bin/git-forest;hb=HEAD

Gitweb should probably not be recoding blobs, so the best I can think of is check for UTF-8 validity and add charset=utf-8 in that case (and in other cases leave the charset undeclared).

The drawback with that is that we cannot send plain blobs without reading them into memory (or reading them twice), since we have to check for UTF-8 validity of the whole blob before sending it. (Gitweb is currently reading the whole blob into memory, but that's unnecessary and could be changed in the future.)

After my next refactoring, there *might* be some chance to easily implement something like "if it's smaller than x KB (e.g. 512), read it into memory, check for valid UTF-8 and optionally add charset=utf-8, otherwise don't read it into memory and send it without charset=utf-8 [or perhaps check for BOM presence at the beginning]." I'll remember if/when it comes up in my refactoring and get back to the mailing list about it.

-- Lea
Previous: Jan EngelhardtNext: Jakub Narebski
Message 2 of 12 in “gitweb forgets to send utf8 header for raw blob views”
  1. Jan EngelhardtMay 28, 2008
  2. Lea WiemannMay 29, 2008
  3. Jakub NarebskiMay 30, 2008
  4. gitweb: Add charset info to "raw" blob outputJakub Narebski, May 31, 2008
  5. Junio C HamanoMay 31, 2008
  6. Jakub NarebskiJun 1, 2008
  7. Jan EngelhardtJun 1, 2008
  8. Jan EngelhardtJun 1, 2008
  9. gitweb: Add charset info to "raw" output of 'text/plain' blobsJakub Narebski, Jun 3, 2008
  10. Jan EngelhardtMay 31, 2008
  11. Jakub NarebskiMay 31, 2008
  12. Jan EngelhardtJun 1, 2008

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.