diff options
author | Arun Isaac | 2019-07-21 21:40:37 +0530 |
---|---|---|
committer | Arun Isaac | 2019-07-21 21:40:37 +0530 |
commit | 7c6f220e95feb3bc79f48aca16b5ca691a561d97 (patch) | |
tree | 9bd27e0cc090923f908e1182a9f666c5cbc885cf | |
parent | aec25de053a0eabe58f1c5b0d6ff66d296e2c5ca (diff) | |
download | guile-email-7c6f220e95feb3bc79f48aca16b5ca691a561d97.tar.gz guile-email-7c6f220e95feb3bc79f48aca16b5ca691a561d97.tar.lz guile-email-7c6f220e95feb3bc79f48aca16b5ca691a561d97.zip |
email: Decode MIME encoded words in Subject header.
Prior to this, MIME encoded words in the Subject header were not
decoded.
* email/email.scm (parse-email-headers): Decode MIME encoded words in
Subject header.
* tests/email.scm ("decode MIME encoded words in Subject header"): New
test.
Reported-by: Ricardo Wurmus <rekado@elephly.net>
-rw-r--r-- | email/email.scm | 2 | ||||
-rw-r--r-- | tests/email.scm | 9 |
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") |