Fix out-of-bounds error when incorporating email from stdin
[mmh] / test / tests / mhbuild / test-header-encode
1 #!/bin/sh
2 ######################################################
3 #
4 # Test encoding headers according to RFC 2047
5 #
6 ######################################################
7
8 . "$MH_TEST_COMMON"
9
10 draft="$MH_TEST_DIR/mhbuild-$$.draft"
11 export MM_CHARSET=UTF-8
12
13 # Subject
14
15 cat >"$draft" <<!
16 From: Mr Foo Bar <foobar@example.com>
17 To: Somebody <somebody@example.com>
18 Subject: This is ä test
19
20 This is a test
21 !
22
23 runandcheck 'mhbuild "$draft"' <<!
24 !
25
26 runandcheck 'sed "/^Content-ID:/s/:.*/: <TESTID>/" "$draft"' <<!
27 From: Mr Foo Bar <foobar@example.com>
28 To: Somebody <somebody@example.com>
29 Subject: =?UTF-8?Q?This_is_=C3=A4_test?=
30 MIME-Version: 1.0
31 Content-Type: text/plain; charset="us-ascii"
32 Content-ID: <TESTID>
33
34 This is a test
35 !
36
37
38 # To + From
39
40 cat >"$draft" <<!
41 From: Jürgen <juergen@example.com>
42 To: Gönül <goenuel@example.com>
43 Subject: Names with Umlauts
44
45 This is a test
46 !
47
48 runandcheck 'mhbuild "$draft"' <<!
49 !
50
51 runandcheck 'sed "/^Content-ID:/s/:.*/: <TESTID>/" "$draft"' <<!
52 From: =?UTF-8?Q?J=C3=BCrgen?= <juergen@example.com>
53 To: =?UTF-8?Q?G=C3=B6n=C3=BCl?= <goenuel@example.com>
54 Subject: Names with Umlauts
55 MIME-Version: 1.0
56 Content-Type: text/plain; charset="us-ascii"
57 Content-ID: <TESTID>
58
59 This is a test
60 !