@@ -166,4 +166,63 @@ test_expect_success 'second message is patch' '
166166 grep "Subject:.*Second" msgtxt2
167167'
168168
169+ test_expect_success ' --compose adds MIME for utf8 body' '
170+ clean_fake_sendmail &&
171+ (echo "#!/bin/sh" &&
172+ echo "echo utf8 body: àéìöú >>\$1"
173+ ) >fake-editor-utf8 &&
174+ chmod +x fake-editor-utf8 &&
175+ echo y | \
176+ GIT_EDITOR=$(pwd)/fake-editor-utf8 \
177+ GIT_SEND_EMAIL_NOTTY=1 \
178+ git send-email \
179+ --compose --subject foo \
180+ --from="Example <nobody@example.com>" \
181+ --to=nobody@example.com \
182+ --smtp-server="$(pwd)/fake.sendmail" \
183+ $patches &&
184+ grep "^utf8 body" msgtxt1 &&
185+ grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
186+ '
187+
188+ test_expect_success ' --compose respects user mime type' '
189+ clean_fake_sendmail &&
190+ (echo "#!/bin/sh" &&
191+ echo "(echo MIME-Version: 1.0"
192+ echo " echo Content-Type: text/plain\\; charset=iso-8859-1"
193+ echo " echo Content-Transfer-Encoding: 8bit"
194+ echo " echo Subject: foo"
195+ echo " echo "
196+ echo " echo utf8 body: àéìöú) >\$1"
197+ ) >fake-editor-utf8-mime &&
198+ chmod +x fake-editor-utf8-mime &&
199+ echo y | \
200+ GIT_EDITOR=$(pwd)/fake-editor-utf8-mime \
201+ GIT_SEND_EMAIL_NOTTY=1 \
202+ git send-email \
203+ --compose --subject foo \
204+ --from="Example <nobody@example.com>" \
205+ --to=nobody@example.com \
206+ --smtp-server="$(pwd)/fake.sendmail" \
207+ $patches &&
208+ grep "^utf8 body" msgtxt1 &&
209+ grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1 &&
210+ ! grep "^Content-Type: text/plain; charset=utf-8" msgtxt1
211+ '
212+
213+ test_expect_success ' --compose adds MIME for utf8 subject' '
214+ clean_fake_sendmail &&
215+ echo y | \
216+ GIT_EDITOR=$(pwd)/fake-editor \
217+ GIT_SEND_EMAIL_NOTTY=1 \
218+ git send-email \
219+ --compose --subject utf8-sübjëct \
220+ --from="Example <nobody@example.com>" \
221+ --to=nobody@example.com \
222+ --smtp-server="$(pwd)/fake.sendmail" \
223+ $patches &&
224+ grep "^fake edit" msgtxt1 &&
225+ grep "^Subject: =?utf-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
226+ '
227+
169228test_done
0 commit comments