]> birchwood-abbey.net Git - mit-scheme.git/commitdiff
edwin/sendmail: Don't abbreviate away content-type if not US-ASCII.
authorTaylor R Campbell <campbell+mit-scheme@mumble.net>
Mon, 25 Oct 2021 23:03:48 +0000 (23:03 +0000)
committerTaylor R Campbell <campbell+mit-scheme@mumble.net>
Mon, 25 Oct 2021 23:03:48 +0000 (23:03 +0000)
`Content-type: text/plain; charset=utf-8' is not optional.

Fixes a bug I introduced over 12 years ago in a fat-fingered cvs
commit with a message about an unrelated change.

src/edwin/sendmail.scm

index 51e721e6566915fef847bb786635d0f937a0544d..98d4a657ef15671b9497effd7538821ba58706f9 100644 (file)
@@ -1327,12 +1327,14 @@ the user from the mailer."
   (newline port))
 
 (define (write-mime-message-body-1 b-start b-end subpart? port)
-  (if (not (and subpart? (ref-variable mail-abbreviate-mime b-start)))
-      (write-message-header-field
-       "Content-Type"
-       (string-append "text/plain; charset="
-                      (ref-variable mail-charset b-start))
-       port))
+  (let ((charset (ref-variable mail-charset b-start)))
+    (if (not (and subpart?
+                 (ref-variable mail-abbreviate-mime b-start)
+                 (string-ci=? "us-ascii" charset)))
+       (write-message-header-field
+        "Content-Type"
+        (string-append "text/plain; charset=" charset)
+        port)))
   (if (or (any-non-printable-7bit-chars? b-start b-end)
          (any-lines-too-long? b-start b-end 76))
       (begin