]> birchwood-abbey.net Git - mit-scheme.git/commitdiff
Quoted-printable encoder is busted since digit->char went lowercase.
authorTaylor R Campbell <campbell+mit-scheme@mumble.net>
Thu, 23 Jul 2020 14:27:30 +0000 (14:27 +0000)
committerTaylor R Campbell <campbell+mit-scheme@mumble.net>
Thu, 23 Jul 2020 14:45:37 +0000 (14:45 +0000)
(cherry picked from commit 821e6f5c4459e9ebb64a7b46af9be66e8fb94be7)

tests/runtime/test-mime-codec.scm

index 53f9b04b7826115af42638642ca46c9a0398007a..f8d141cfb5b00d3501b8dde0d5f5b78365050ba9 100644 (file)
@@ -283,4 +283,31 @@ USA.
   encode-uue:update
   decode-uue:initialize
   decode-uue:finalize
-  decode-uue:update)
\ No newline at end of file
+  decode-uue:update)
+\f
+(define (encode-quoted-printable string text?)
+  (call-with-output-string
+    (lambda (output-port)
+      (let ((context (encode-quoted-printable:initialize output-port text?)))
+       (encode-quoted-printable:update context string)
+       (encode-quoted-printable:finalize context)))))
+
+(define-test 'QUOTED-PRINTABLE/UPPERCASE
+  (lambda ()
+    ;; Currently uses digit->char which no longer produces uppercase.
+    (expect-failure
+     (lambda ()
+       (let* ((string "The quïck brøwn fox jump§ over the lazʒ doﻎ.")
+             (utf8 (string->utf8 string))
+             (bytestring (iso8859-1->string utf8)))
+        (assert-equal
+         (encode-quoted-printable bytestring #t)
+         (string-append "The qu=C3=AFck br=C3=B8wn=C2=A0fox jump=C2=A7"
+                        " over the laz=CA=92 do=EF=BB=\n=8E.")))))))
+
+(define-test 'QUOTED-PRINTABLE/UNICODE-BUG
+  (lambda ()
+    ;; Can't handle Unicode strings, only legacy byte strings so far.
+    (expect-error
+     (lambda ()
+       (encode-quoted-printable "üñîçøðε" #t)))))
\ No newline at end of file