[PATCH] Use =20 when rfc2047 encoding spaces.
- From
- Kristian Høgsberg <hoegsberg@gmail.com>
- Date
- Jun 1, 2007, 21:08 UTC
- Message-ID
- <11807320922292-git-send-email-hoegsberg@gmail.com>
Encode ' ' using '=20' even though rfc2047 allows using '_' for readability. Unfortunately, much software doesn't understand this and just leaves the underscore in place. Using '=20' seems to work better.
Signed-off-by: Kristian Høgsberg <hoegsberg@gmail.com> --- commit.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/commit.c b/commit.c index bee066f..92b46f1 100644 --- a/commit.c +++ b/commit.c @@ -511,12 +511,14 @@ 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, + * doesn't understand this and just leaves the + * underscore in place. */ + if (is_rfc2047_special(ch) || ch == ' ') { sprintf(bp, "=%02X", ch); bp += 3; } - else if (ch == ' ') - *bp++ = '_'; else *bp++ = ch; }
-- 1.5.0.6