Implement quoted-printable conversion.

This commit is contained in:
Dominik Pantůček 2023-04-11 14:17:37 +02:00
parent 418468f46e
commit 65e0e3154e
2 changed files with 42 additions and 2 deletions

View file

@ -35,6 +35,7 @@
(import scheme
(chicken base)
(chicken keyword)
(chicken string)
util-io
util-string)
@ -43,8 +44,14 @@
;; Encodes given UTF-8 string as quoted-printable
(define (string->qp str)
(let ((lst (string->list/utf8 str)))
str))
(let loop ((lst (string->list/utf8 str))
(res '()))
(if (null? lst)
(string-intersperse (reverse res) "")
(loop (cdr lst)
(cons (let ((chs (car lst)))
chs)
res)))))
;; Ensures the subject has proper encoding
(define (encode-subject subj)