guile-email discussion
 help / color / mirror / Atom feed
* [PATCH] email: Support quoted-printable CR LF sequences.
@ 2023-01-03 12:19 Andrew Whatson
  2023-01-03 14:21 ` Arun Isaac
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Whatson @ 2023-01-03 12:19 UTC (permalink / raw)
  To: guile-email; +Cc: Andrew Whatson

* email/quoted-printable.scm (quoted-printable-decode): Ignore "=\r\n"
sequences in the input.
* tests/quoted-printable.scm ("quoted-printable decoding of soft line
breaks (=\\n)", "quoted-printable decoding of soft line
breaks (=\\r\\n)"): New tests.
---
 email/quoted-printable.scm | 5 +++--
 tests/quoted-printable.scm | 6 ++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/email/quoted-printable.scm b/email/quoted-printable.scm
index 2c5d7a7..9d71200 100644
--- a/email/quoted-printable.scm
+++ b/email/quoted-printable.scm
@@ -41,11 +41,12 @@
        (cond
         ((eof-object? c) out)
         ((char=? c #\=)
-         ;; TODO: Support "\r\n" line ending
          (let ((c1 (read-char in)))
            (unless (char=? c1 #\Newline)
              (let ((c2 (read-char in)))
-               (put-u8 out (string->number (string c1 c2) 16)))))
+               (unless (and (char=? c1 #\Return)
+                            (char=? c2 #\Newline))
+                 (put-u8 out (string->number (string c1 c2) 16))))))
          (quoted-printable-decode in out))
         (else (put-u8 out (char->integer c))
               (quoted-printable-decode in out)))))))
diff --git a/tests/quoted-printable.scm b/tests/quoted-printable.scm
index bfbd985..2a1f068 100644
--- a/tests/quoted-printable.scm
+++ b/tests/quoted-printable.scm
@@ -67,6 +67,12 @@ abriquent pour te la vendre une =C3=A2me vulgaire.")
    (quoted-printable-escape-encode-char #\return)
    (quoted-printable-escape-encode-char #\newline)))
 
+(test-equal "quoted-printable decoding of soft line breaks (=\\n)"
+  (quoted-printable-decode "=\n") #vu8())
+
+(test-equal "quoted-printable decoding of soft line breaks (=\\r\\n)"
+  (quoted-printable-decode "=\r\n") #vu8())
+
 (test-assert "quoted-printable random bytevector: quoted-printable-encode and quoted-printable-decode are inverses of each other"
   (every (lambda (len)
            (let ((x (random-bytevector len)))
-- 
2.38.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] email: Support quoted-printable CR LF sequences.
  2023-01-03 12:19 [PATCH] email: Support quoted-printable CR LF sequences Andrew Whatson
@ 2023-01-03 14:21 ` Arun Isaac
  2023-01-04 10:24   ` Andrew Whatson
  0 siblings, 1 reply; 4+ messages in thread
From: Arun Isaac @ 2023-01-03 14:21 UTC (permalink / raw)
  To: Andrew Whatson; +Cc: guile-email


Hi Andrew,

Thanks for the patch! I love it that you added tests as well. Made my
job very easy. :-) I have applied the patch.
https://git.systemreboot.net/guile-email/commit/?id=8a9c14473f0ae449bfbfe77ba680734e4a14562f

I have also thanked you in the Contributors section.
https://git.systemreboot.net/guile-email/commit/?id=5795aeb486be24a5b5f202cf2d333a374ffb798d

Regards,
Arun


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] email: Support quoted-printable CR LF sequences.
  2023-01-03 14:21 ` Arun Isaac
@ 2023-01-04 10:24   ` Andrew Whatson
  2023-01-05  0:03     ` Arun Isaac
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Whatson @ 2023-01-04 10:24 UTC (permalink / raw)
  To: Arun Isaac; +Cc: guile-email

On 4/1/23 00:21, Arun Isaac wrote:
> > Thanks for the patch! I love it that you added tests as well. Made my
> job very easy. :-) I have applied the patch.
> https://git.systemreboot.net/guile-email/commit/?id=8a9c14473f0ae449bfbfe77ba680734e4a14562f
> 
> I have also thanked you in the Contributors section.
> https://git.systemreboot.net/guile-email/commit/?id=5795aeb486be24a5b5f202cf2d333a374ffb798d

Hi Arun,

Thanks for review & merge :)

I've been running guile-email across Gmane mailing list archives so may 
have some more patches for weird and wonderful edge-cases coming soon.

Cheers,
Andrew



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] email: Support quoted-printable CR LF sequences.
  2023-01-04 10:24   ` Andrew Whatson
@ 2023-01-05  0:03     ` Arun Isaac
  0 siblings, 0 replies; 4+ messages in thread
From: Arun Isaac @ 2023-01-05  0:03 UTC (permalink / raw)
  To: Andrew Whatson; +Cc: guile-email


Hi Andrew,

Your patches are most welcome! Always a pleasure to hear that
guile-email is seeing real-world usage.

Regards,
Arun


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-05  0:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03 12:19 [PATCH] email: Support quoted-printable CR LF sequences Andrew Whatson
2023-01-03 14:21 ` Arun Isaac
2023-01-04 10:24   ` Andrew Whatson
2023-01-05  0:03     ` Arun Isaac

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox