Subject: Re: git format-patch doesn't add Content-type for UTF-8 diffs

From: Paul Eggert <[email-masked]>
Date: Mon, 30 Jun 2014 11:54:03 -0700

Jeff King wrote:
> How do you send the mails after they come out of format-patch?

I run a shell command like this (on Solaris 10):

/usr/lib/sendmail -ONoRecipientAction=add-to [email-masked] < 
0001-whatever.patch

(The "NoRecipientAction" option pacifies the IANA MTA.)

This is an old machine not under my control, with an old 'git' installed 
that I don't use and don't particularly want to worry about porting to. 
  I generate the patch file on a different machine with git 1.9.3, and 
scp it into the email-sending machine.

I suppose that I could work around the problem with this shell command:

(grep -q '^Mime-Version: ' 0001-whatever.patch ||
    printf '%s\n' \
      'MIME-Version: 1.0' \
      'Content-Type: text/plain; charset=UTF-8' \
      'Content-Transfer-Encoding: 8bit'
  cat 0001-whatever.patch) |
/usr/lib/sendmail -ONoRecipientAction=add-to [email-masked]

but that's less convenient.

> I wonder if it would be enough to do:
>
>   1. Always add a content-type header, even if the commit is utf-8 and
>      contains only ascii characters.

That would help for my case, yes.  We use only UTF-8, and to me it 
feelds weird that patches are mailed properly if the commit log contains 
non-ASCII characters, but don't work if the commit log is ASCII and the 
diff contains non-ASCII.