git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "Øyvind A. Holm" <sunny@sunbase.org>, git@vger.kernel.org
Subject: Re: MIME problem when using git format-patch / git am
Date: Sun, 25 Apr 2010 20:49:41 -0500	[thread overview]
Message-ID: <20100426014941.GA29220@progeny.tock> (raw)
In-Reply-To: <20100425233549.GA8737@triton>

Hi,

Øyvind A. Holm wrote:

| git commit -m "Initial commit" --allow-empty
| git tag firstrev
| echo First line >foo.txt
| git add foo.txt
| git commit -m "First commit without 8-bit chars"
| echo Second line >>foo.txt
| git commit -m "Second commit with © in first line of logmsg" -a
| echo Third line >>foo.txt
| git commit -m "Third commit with no 8-bit in first line`echo; echo but €uro further down`" -a
| echo Fourth line >>foo.txt
| git commit -m "Fourth commit with © in first line again" -a
| git format-patch firstrev
| git checkout -b patches firstrev
| git am 0*
| git log
[...]
|    Applying: =?UTF-8?q?Third=20commit=20with=20no=208-bit=20in=20first=20line
|    Applying: Fourth commit with © in first line again

On this machine, it’s even worse:

    =?UTF-8?q?Third=20commit=20with=20no=208-bit=20in=20first=20line
    
    =20but=20=E2=82=ACuro=20further=20down?=
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit

An encoded-word [1] is defined to be at most 75 characters long and not
to contain whitespace.  On the other hand, multiple encoded-words
within a field are required to be separated by whitespace.

[1] http://tools.ietf.org/html/rfc2047

This leads to a question: what if one wants to include a word that
quotes to more than 75 characters?  How about more than 997 ASCII
characters without whitespace?  No can do.

Ideally, I would like to see git quoting single words, though I admit
I have not seen how well various user agents cope with this.

Maybe this patch would give you some joy until then.  Feel free to pick
it up and take it somewhere more useful.

Thanks,
Jonathan

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

diff --git a/pretty.c b/pretty.c
index d493cad..b822e24 100644
--- a/pretty.c
+++ b/pretty.c
@@ -131,7 +131,7 @@ needquote:
 		 * many programs do not understand this and just
 		 * leave the underscore in place.
 		 */
-		if (is_rfc2047_special(ch) || ch == ' ') {
+		if (is_rfc2047_special(ch) || ch == ' ' || ch == '\n') {
 			strbuf_add(sb, line + last, i - last);
 			strbuf_addf(sb, "=%02X", ch);
 			last = i + 1;

  reply	other threads:[~2010-04-26  1:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-25 23:35 MIME problem when using git format-patch / git am Øyvind A. Holm
2010-04-26  1:49 ` Jonathan Nieder [this message]
2010-04-26  8:50   ` Peter Krefting
2010-04-27 15:32     ` Jonathan Nieder

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=20100426014941.GA29220@progeny.tock \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sunny@sunbase.org \
    /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).