aboutsummaryrefslogtreecommitdiff
path: root/email
diff options
context:
space:
mode:
authorArun Isaac2019-09-17 01:11:44 +0530
committerArun Isaac2019-09-17 01:43:53 +0530
commit203c9c2ae39a4c64bfd9199bbc2deae03c347998 (patch)
treea1c94430104662b5b3354aeb1ee7af6592f4e4b1 /email
parent57d0de6230a95866f7b866cbe4b3481d10dfd1a2 (diff)
downloadguile-email-203c9c2ae39a4c64bfd9199bbc2deae03c347998.tar.gz
guile-email-203c9c2ae39a4c64bfd9199bbc2deae03c347998.tar.lz
guile-email-203c9c2ae39a4c64bfd9199bbc2deae03c347998.zip
email: Tolerate non-ASCII characters in headers.
We tolerate non-ASCII characters in headers in order to support Emacs message mode parens style addresses. * email/email.scm (email->headers+body): Read headers as UTF-8 characters. * tests/email.scm ("tolerate non-ascii characters in headers"): New tests. Reported-by: Christopher Baines <mail@cbaines.net>
Diffstat (limited to 'email')
-rw-r--r--email/email.scm9
1 files changed, 8 insertions, 1 deletions
diff --git a/email/email.scm b/email/email.scm
index 2c4178e..f276019 100644
--- a/email/email.scm
+++ b/email/email.scm
@@ -605,7 +605,14 @@ values. The returned headers is a string and body is a bytevector."
(call-with-port
(open-bytevector-input-port email)
(lambda (port)
- (set-port-encoding! port "us-ascii")
+ ;; Email headers must strictly be ASCII characters. But for the
+ ;; sake of supporting Emacs message mode parens style addresses
+ ;; that may use non-ASCII characters, typically for the full
+ ;; name, we relax this requirement. We assume an encoding of
+ ;; UTF-8, and hope that everything turns out fine. Since UTF-8
+ ;; is a superset of ASCII, this should not affect standards
+ ;; conforming headers.
+ (set-port-encoding! port "utf-8")
(let ((headers (read-while port get-line-with-delimiter
(lambda (line)
(not (or (string= line "\n")