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

[PATCH 1/2] hooks/post-receive-email: set encoding to utf-8

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Mar 8, 2012, 11:57 UTC
Message-ID
<20120308115754.GA2750@burratino>
In-Reply-To
<20120308115119.GA2604@burratino>
From: Gerrit Pape <pape@smarden.org>

"git log" generates logs in UTF-8 encoding by default, but the post-receive-email example hook does not declare any encoding in the emails it sends. So add a line there:

+	Content-Type: text/plain; charset=utf-8

[jn: tweaked to also set the Content-Transfer-Encoding so MTAs know what kind of mangling might be needed when sending to a non 8-bit clean SMTP host]

Requested-by: Alexander Gerasiov <gq@cs.msu.su>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 contrib/hooks/post-receive-email |    3 +++
 1 file changed, 3 insertions(+)
diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 01af9df1..dc184d0b 100755
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -233,6 +233,9 @@ generate_email_header()
 	cat <<-EOF
 	To: $recipients
 	Subject: ${emailprefix}$projectdesc $refname_type $short_refname ${change_type}d. $describe
+	MIME-Version: 1.0
+	Content-Type: text/plain; charset=utf-8
+	Content-Transfer-Encoding: 8bit
 	X-Git-Refname: $refname
 	X-Git-Reftype: $refname_type
 	X-Git-Oldrev: $oldrev
-- 
1.7.9.2
Previous: Jonathan NiederNext: Jonathan Nieder
Message 2 of 9 in “post-receive-email: declaring and consistently using one output encoding”
  1. 0/2 post-receive-email: declaring and consistently using one output encodingJonathan Nieder, Mar 8, 2012
  2. 1/2 hooks/post-receive-email: set encoding to utf-8Jonathan Nieder, Mar 8, 2012
  3. 2/2 post-receive-email: defend against non UTF-8 i18n.logoutputencoding settingJonathan Nieder, Mar 8, 2012
  4. Jeff KingMar 8, 2012
  5. Jonathan NiederMar 8, 2012
  6. Alexey ShumkinMar 14, 2012
  7. Jonathan NiederMar 14, 2012
  8. Junio C HamanoMar 8, 2012
  9. Jon JensenMar 14, 2012

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.