Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <hoegsberg@gmail.com>2007-06-02 01:08:12 +0400
committerJunio C Hamano <junkio@cox.net>2007-06-02 23:00:26 +0400
commit996e2d6ea2626f55a59e70ac7305a02ce0171814 (patch)
tree862992d853778edeff99cb1ade8b703a7af71c7d
parentcedb8d5d33e6496cfc70493db841b3db886e8658 (diff)
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>
-rw-r--r--commit.c10
-rwxr-xr-xt/t3901-i18n-patch.sh10
2 files changed, 12 insertions, 8 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;
}
diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh
index a881797bc7..24bf0ee018 100755
--- a/t/t3901-i18n-patch.sh
+++ b/t/t3901-i18n-patch.sh
@@ -13,7 +13,7 @@ check_encoding () {
while test "$i" -le $cnt
do
git format-patch --encoding=UTF-8 --stdout HEAD~$i..HEAD~$j |
- grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD_=C3=B3=C3=BA?=" &&
+ grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" &&
git-cat-file commit HEAD~$j |
case "$header" in
8859)
@@ -73,9 +73,9 @@ test_expect_success 'format-patch output (ISO-8859-1)' '
git format-patch --stdout master..HEAD^ >out-l1 &&
git format-patch --stdout HEAD^ >out-l2 &&
grep "^Content-Type: text/plain; charset=ISO-8859-1" out-l1 &&
- grep "^From: =?ISO-8859-1?q?=C1=E9=ED_=F3=FA?=" out-l1 &&
+ grep "^From: =?ISO-8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l1 &&
grep "^Content-Type: text/plain; charset=ISO-8859-1" out-l2 &&
- grep "^From: =?ISO-8859-1?q?=C1=E9=ED_=F3=FA?=" out-l2
+ grep "^From: =?ISO-8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l2
'
test_expect_success 'format-patch output (UTF-8)' '
@@ -84,9 +84,9 @@ test_expect_success 'format-patch output (UTF-8)' '
git format-patch --stdout master..HEAD^ >out-u1 &&
git format-patch --stdout HEAD^ >out-u2 &&
grep "^Content-Type: text/plain; charset=UTF-8" out-u1 &&
- grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD_=C3=B3=C3=BA?=" out-u1 &&
+ grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u1 &&
grep "^Content-Type: text/plain; charset=UTF-8" out-u2 &&
- grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD_=C3=B3=C3=BA?=" out-u2
+ grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u2
'
test_expect_success 'rebase (U/U)' '