git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: Jeff King <peff@peff.net>
Cc: Teemu Likonen <tlikonen@iki.fi>,
	git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Samuel Tardieu <sam@rfc1149.net>
Subject: Re: MIME headers in introductory message (git send-email --compose)
Date: Thu, 10 Apr 2008 20:47:03 +0200	[thread overview]
Message-ID: <20080410184703.GA14912@efreet.light.src> (raw)
In-Reply-To: <20080325230649.GA5273@coredump.intra.peff.net>

On Tue, Mar 25, 2008 at 19:06:49 -0400, Jeff King wrote:
> 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>

      parent reply	other threads:[~2008-04-10 18:48 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13 16:40 [PATCH] Add MIME information to outgoing email Samuel Tardieu
2008-03-13 17:00 ` Jeff King
2008-03-13 17:14   ` Samuel Tardieu
2008-03-14 13:29     ` Jeff King
2008-03-14 13:40       ` Samuel Tardieu
2008-03-14 13:46         ` Jeff King
2008-03-14 13:50           ` Samuel Tardieu
2008-03-14 14:35             ` Jeff King
2008-03-14 14:40               ` Samuel Tardieu
2008-03-14 16:20   ` Junio C Hamano
2008-03-14 20:21     ` Re* " Junio C Hamano
2008-03-14 21:27       ` Jeff King
2008-03-13 18:48 ` Junio C Hamano
2008-03-13 19:05   ` Samuel Tardieu
2008-03-14 11:21     ` Brian Swetland
2008-03-14 11:57       ` Samuel Tardieu
2008-03-25 18:31   ` MIME headers in introductory message (git send-email --compose) Teemu Likonen
2008-03-25 19:17     ` Jay Soffian
2008-03-25 20:47       ` Junio C Hamano
2008-03-25 20:59         ` Jay Soffian
2008-03-25 21:56         ` Jeff King
2008-03-25 22:07           ` Jeff King
2008-03-25 23:06     ` Jeff King
2008-03-26  2:46       ` Jay Soffian
2008-04-10 18:47       ` Jan Hudec [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080410184703.GA14912@efreet.light.src \
    --to=bulb@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=sam@rfc1149.net \
    --cc=tlikonen@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).