summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorKristian Høgsberg <hoegsberg@gmail.com>2007-06-01 17:08:12 -0400
committerJunio C Hamano <junkio@cox.net>2007-06-02 12:00:26 -0700
commit996e2d6ea2626f55a59e70ac7305a02ce0171814 (patch)
tree862992d853778edeff99cb1ade8b703a7af71c7d /commit.c
parentcedb8d5d33e6496cfc70493db841b3db886e8658 (diff)
downloadgit-996e2d6ea2626f55a59e70ac7305a02ce0171814.tar.gz
Use =20 when rfc2047 encoding spaces.
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 <hoegsberg@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c10
1 files changed, 7 insertions, 3 deletions
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;
}