summaryrefslogtreecommitdiff
path: root/email
diff options
context:
space:
mode:
authorArun Isaac2018-09-12 17:56:13 +0530
committerArun Isaac2018-09-12 17:57:51 +0530
commit81c3ae5e6d80efd3c87f42552876697c498005d2 (patch)
treea109d1533340d5e248523fb6c1dd74f517a960aa /email
parent2784c121d5a3c9d8e7831c883edac3b6857bc198 (diff)
downloadguile-email-81c3ae5e6d80efd3c87f42552876697c498005d2.tar.gz
guile-email-81c3ae5e6d80efd3c87f42552876697c498005d2.tar.lz
guile-email-81c3ae5e6d80efd3c87f42552876697c498005d2.zip
quoted-printable: Add q-encoding-encode.
* email/quoted-printable.scm (q-encoding-encode): New function. * tests/quoted-printable.scm (q-encoding wikipedia example): Rename to ... (q-encoding wikipedia example: decoding): ... this. (q-encoding wikipedia example: encoding): New test.
Diffstat (limited to 'email')
-rw-r--r--email/quoted-printable.scm9
1 files changed, 8 insertions, 1 deletions
diff --git a/email/quoted-printable.scm b/email/quoted-printable.scm
index b6f4c54..11abaff 100644
--- a/email/quoted-printable.scm
+++ b/email/quoted-printable.scm
@@ -24,7 +24,8 @@
#:use-module (srfi srfi-26)
#:export (quoted-printable-decode
quoted-printable-encode
- q-encoding-decode))
+ q-encoding-decode
+ q-encoding-encode))
;; TODO: Error out on invalid quoted-printable input
(define quoted-printable-decode
@@ -89,3 +90,9 @@
(lambda (c)
(if (char=? c #\_) #\Space c))
str)))
+
+(define (q-encoding-encode bv)
+ (string-map
+ (lambda (c)
+ (if (char=? c #\Space) #\_ c))
+ (quoted-printable-encode bv)))