summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--email/email.scm2
-rw-r--r--tests/email.scm9
2 files changed, 11 insertions, 0 deletions
diff --git a/email/email.scm b/email/email.scm
index 20bf291..752c941 100644
--- a/email/email.scm
+++ b/email/email.scm
@@ -812,6 +812,8 @@ list of header keys and values."
(content . ,post-process-content-type)
(encoding . ,post-process-content-transfer-encoding)
(disposition . ,post-process-content-disposition)
+ (subject . ,(match-lambda* (`(subject ,subject)
+ `(subject ,(decode-mime-encoded-word subject)))))
(fields . ,(lambda (_ . fields)
(add-default-headers
(filter-map (match-lambda
diff --git a/tests/email.scm b/tests/email.scm
index fb2c45b..ab2a408 100644
--- a/tests/email.scm
+++ b/tests/email.scm
@@ -144,4 +144,13 @@ foo
"=?iso-8859-1?Q?=A1Hola,_se=F1or!?= =?UTF-8?Q?B=C3=A3r?=")
"¡Hola, señor! Bãr")
+(test-equal "decode MIME encoded words in Subject header"
+ (parse-email-headers "Subject: Foo =?UTF-8?Q?B=C3=A3r?=
+")
+ `((content-type (type . text)
+ (subtype . plain)
+ (charset . "utf-8"))
+ (content-transfer-encoding . 7bit)
+ (subject . "Foo Bãr")))
+
(test-end "email")