git format-patch doesn't add Content-type for UTF-8 diffs
- From
Paul Eggert <eggert@cs.ucla.edu>
- Date
- Jun 30, 2014, 09:03 UTC
- Message-ID
- <53B127DD.8000807@cs.ucla.edu>
I've been having trouble sending my Git-generated patches to the tz mailing list. Patches containing UTF-8 text are garbled, e.g., if you visit <http://mm.icann.org/pipermail/tz/2014-June/021086.html> you'll see "Ürümqi" where the patch actually had "Ürümqi".
I've tracked this down to the fact that "git format-patch" isn't outputting a Content-Type: line in the outgoing email. I thought it was supposed to do that; the man page implies that it does.
Here's how I can reproduce the bug with the git 1.9.3 that's shipped with Fedora 20. Notice that the patch is missing the line "Content-Type: text/plain; charset=UTF-8" that the git-format-patch man page implies it should be generating, and this causes the ICANN email software to misinterpret the patch's character set encoding.
$ git init Initialized empty Git repository in /home/eggert/junk/d/.git/ $ echo x >x $ git add x $ git commit -m'x' [master (root-commit) 5d0e0ce] x 1 file changed, 1 insertion(+) create mode 100644 x $ echo '§' >x $ git commit -am'added UTF-8' [master 57f0669] added UTF-8 1 file changed, 1 insertion(+), 1 deletion(-) $ git format-patch -1 0001-added-UTF-8.patch $ cat 0001-added-UTF-8.patch From 57f066927a1d8e253715b7980460d81cb549b162 Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@cs.ucla.edu> Date: Mon, 30 Jun 2014 01:49:28 -0700 Subject: [PATCH] added UTF-8
--- x | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x b/x index 587be6b..3038d22 100644 --- a/x +++ b/x @@ -1 +1 @@ -x +§ -- 1.9.3