Skip to content

Commit

Permalink
send-email: use UTF-8 rather than utf-8 for consistency
Browse files Browse the repository at this point in the history
The rest of the git source has been converted to use upper-case character
encoding names to assist older platforms.  The charset attribute of MIME
is defined to be case-insensitive, but older platforms may still have an
easier time dealing with upper-case rather than lower-case.  So do so for
send-email too.

Update t9001 to handle the changes.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Brandon Casey authored and Junio C Hamano committed Jun 9, 2009
1 parent a3a8262 commit d1fff6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ ($)
if ($need_8bit_cte) {
print C2 "MIME-Version: 1.0\n",
"Content-Type: text/plain; ",
"charset=utf-8\n",
"charset=UTF-8\n",
"Content-Transfer-Encoding: 8bit\n";
}
} elsif (/^MIME-Version:/i) {
Expand Down Expand Up @@ -766,7 +766,7 @@ sub unquote_rfc2047 {

sub quote_rfc2047 {
local $_ = shift;
my $encoding = shift || 'utf-8';
my $encoding = shift || 'UTF-8';
s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
s/(.*)/=\?$encoding\?q\?$1\?=/;
return $_;
Expand Down
8 changes: 4 additions & 4 deletions t/t9001-send-email.sh
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ test_expect_success 'utf8 Cc is rfc2047 encoded' '
--smtp-server="$(pwd)/fake.sendmail" \
outdir/*.patch &&
grep "^Cc:" msgtxt1 |
grep "=?utf-8?q?=C3=A0=C3=A9=C3=AC=C3=B6=C3=BA?= <utf8@example.com>"
grep "=?UTF-8?q?=C3=A0=C3=A9=C3=AC=C3=B6=C3=BA?= <utf8@example.com>"
'

test_expect_success '--compose adds MIME for utf8 body' '
Expand All @@ -550,7 +550,7 @@ test_expect_success '--compose adds MIME for utf8 body' '
--smtp-server="$(pwd)/fake.sendmail" \
$patches &&
grep "^utf8 body" msgtxt1 &&
grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1
'

test_expect_success '--compose respects user mime type' '
Expand All @@ -573,7 +573,7 @@ test_expect_success '--compose respects user mime type' '
$patches &&
grep "^utf8 body" msgtxt1 &&
grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1 &&
! grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
! grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1
'

test_expect_success '--compose adds MIME for utf8 subject' '
Expand All @@ -586,7 +586,7 @@ test_expect_success '--compose adds MIME for utf8 subject' '
--smtp-server="$(pwd)/fake.sendmail" \
$patches &&
grep "^fake edit" msgtxt1 &&
grep "^Subject: =?utf-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
grep "^Subject: =?UTF-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
'

test_expect_success 'detects ambiguous reference/file conflict' '
Expand Down

0 comments on commit d1fff6f

Please sign in to comment.