From 0fcec2ce5467740eb613da6a977deca3e7e866ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= Date: Thu, 18 Oct 2012 16:43:32 +0200 Subject: format-patch: make rfc2047 encoding more strict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RFC 2047 requires more characters to be encoded than it is currently done. Especially, RFC 2047 distinguishes between allowed remaining characters in encoded words in addresses (From, To, etc.) and other headers, such as Subject. Make add_rfc2047() and is_rfc2047_special() location dependent and include all non-allowed characters to hopefully be RFC 2047 conformant. This especially fixes a problem, where RFC 822 specials (e. g. ".") were left unencoded in addresses, which was solved with a non-standard-conforming workaround in the past (which is going to be removed in a follow-up patch). Signed-off-by: Jan H. Schönherr Signed-off-by: Junio C Hamano --- t/t4014-format-patch.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 't/t4014-format-patch.sh') diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 1d5636d8a0..727d606884 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -818,21 +818,28 @@ check_author() { cat >expect <<'EOF' From: "Foo B. Bar" EOF -test_expect_success 'format-patch quotes dot in headers' ' +test_expect_success 'format-patch quotes dot in from-headers' ' check_author "Foo B. Bar" ' cat >expect <<'EOF' From: "Foo \"The Baz\" Bar" EOF -test_expect_success 'format-patch quotes double-quote in headers' ' +test_expect_success 'format-patch quotes double-quote in from-headers' ' check_author "Foo \"The Baz\" Bar" ' cat >expect <<'EOF' -From: =?UTF-8?q?"F=C3=B6o=20B.=20Bar"?= +From: =?UTF-8?q?F=C3=B6o=20Bar?= EOF -test_expect_success 'rfc2047-encoded headers also double-quote 822 specials' ' +test_expect_success 'format-patch uses rfc2047-encoded from-headers when necessary' ' + check_author "Föo Bar" +' + +cat >expect <<'EOF' +From: =?UTF-8?q?F=C3=B6o=20B=2E=20Bar?= +EOF +test_expect_failure 'rfc2047-encoded from-headers leave no rfc822 specials' ' check_author "Föo B. Bar" ' -- cgit v1.2.3