summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--email/email.scm2
-rw-r--r--tests/email.scm12
2 files changed, 13 insertions, 1 deletions
diff --git a/email/email.scm b/email/email.scm
index 666bd3e..1960456 100644
--- a/email/email.scm
+++ b/email/email.scm
@@ -910,7 +910,7 @@ list of header keys and values."
((#{7bit}# #{8bit}# binary) body)
(else (error "Body decoding failed. Unknown encoding" encoding)))))
(if charset
- (bytevector->string decoded-octets charset)
+ (bytevector->string decoded-octets charset 'substitute)
decoded-octets)))
(define (read-next-email-in-mbox port)
diff --git a/tests/email.scm b/tests/email.scm
index 1a0ec34..48056b7 100644
--- a/tests/email.scm
+++ b/tests/email.scm
@@ -322,6 +322,18 @@ body" "iso-8859-1"))
(charset . "utf-8")
(charset . "foo"))))
+(test-equal "tolerate decoding errors in body"
+ (parse-email
+ "Content-Transfer-Encoding: quoted-printable
+
+copyright =A9")
+ (make-email
+ `((content-type (type . text)
+ (subtype . plain)
+ (charset . "utf-8"))
+ (content-transfer-encoding . quoted-printable))
+ "copyright �"))
+
(test-equal "parse name-addr email address"
(parse-email-address "Foo <foo@example.org>")
'((name . "Foo") (address . "foo@example.org")))