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

Re: MIME headers in introductory message (git send-email --compose)

From
JHJan Hudec <bulb@ucw.cz>
Date
Apr 10, 2008, 18:47 UTC
Message-ID
<20080410184703.GA14912@efreet.light.src>
In-Reply-To
<20080325230649.GA5273@coredump.intra.peff.net>
On Tue, Mar 25, 2008 at 19:06:49 -0400, Jeff King wrote:
Show 16 quoted lines
> On Tue, Mar 25, 2008 at 08:31:16PM +0200, Teemu Likonen wrote:
> 
> > By the way, 'git send-email --compose' does not add MIME headers to 
> > introductory message. All non-Ascii chars will output something 
> > undefined in receivers' end.
> > 
> > I guess the right way would be to detect user's charset (locale) and add 
> > appropriate MIME headers. Also, the Subject field should be encoded if 
> > it contains non-Ascii characters.
> 
> I just posted some patches to fix this; however, they always encode as
> utf-8. I'm not sure what is the best way to find the user's encoding.
> AIUI, locale environment variables are not enough, since, e.g., "en_US"
> could come in iso8859-1 and utf-8 flavors. Is there a portable way to
> figure this out? Should we be pulling it from .git/config? Neither the
> commitEncoding nor the logOutputEncoding really makes sense to reuse.

The portable way is to use the locale environment variables, but you have to read them via the libc locale interface. You set the LC_CTYPE locale category via setlocale (which will consult LC_CTYPE, LC_ALL and LANG environment AND the locale database) and than ask for charset using nl_langinfo(CODESET). To do the equivalent from the shell, call `locale charmap`. From perl, either use langinfo in I18N::Langinfo, or just use the ':locale' IO stream option provided by encoding pragma to read the file in unicode no matter what the locale encoding was (this is perl 5.8.<something> -- in older one, you'd have to use I18N::Langinfo anyway).

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
Previous: Jay Soffian
Message 25 of 25 in “Add MIME information to outgoing email”
  1. Add MIME information to outgoing emailSamuel Tardieu, Mar 13, 2008
  2. Jeff KingMar 13, 2008
  3. Samuel TardieuMar 13, 2008
  4. Jeff KingMar 14, 2008
  5. Samuel TardieuMar 14, 2008
  6. Jeff KingMar 14, 2008
  7. Samuel TardieuMar 14, 2008
  8. Jeff KingMar 14, 2008
  9. Samuel TardieuMar 14, 2008
  10. Junio C HamanoMar 14, 2008
  11. Re* [PATCH] Add MIME information to outgoing emailJunio C Hamano, Mar 14, 2008
  12. Jeff KingMar 14, 2008
  13. Junio C HamanoMar 13, 2008
  14. Samuel TardieuMar 13, 2008
  15. Brian SwetlandMar 14, 2008
  16. Samuel TardieuMar 14, 2008
  17. MIME headers in introductory message (git send-email --compose)Teemu Likonen, Mar 25, 2008
  18. Jay SoffianMar 25, 2008
  19. Junio C HamanoMar 25, 2008
  20. Jay SoffianMar 25, 2008
  21. Jeff KingMar 25, 2008
  22. Jeff KingMar 25, 2008
  23. Jeff KingMar 25, 2008
  24. Jay SoffianMar 26, 2008
  25. Jan HudecApr 10, 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.