From 996e2d6ea2626f55a59e70ac7305a02ce0171814 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Fri, 1 Jun 2007 17:08:12 -0400 Subject: Use =20 when rfc2047 encoding spaces. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Encode ' ' using '=20' even though rfc2047 allows using '_' for readability. Unfortunately, many programs do not understand this and just leave the underscore in place. Using '=20' seems to work better. [jc: with adjustment to t3901] Signed-off-by: Kristian Høgsberg Signed-off-by: Junio C Hamano --- commit.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'commit.c') diff --git a/commit.c b/commit.c index bee066fa32..5632e32685 100644 --- a/commit.c +++ b/commit.c @@ -511,12 +511,16 @@ static int add_rfc2047(char *buf, const char *line, int len, bp += i; for (i = 0; i < len; i++) { unsigned ch = line[i] & 0xFF; - if (is_rfc2047_special(ch)) { + /* + * We encode ' ' using '=20' even though rfc2047 + * allows using '_' for readability. Unfortunately, + * many programs do not understand this and just + * leave the underscore in place. + */ + if (is_rfc2047_special(ch) || ch == ' ') { sprintf(bp, "=%02X", ch); bp += 3; } - else if (ch == ' ') - *bp++ = '_'; else *bp++ = ch; } -- cgit v1.2.3