]> diplodocus.org Git - nmh/blobdiff - uip/mhbuildsbr.c
Add a new (but incomplete) test for mhbuild's new functionality.
[nmh] / uip / mhbuildsbr.c
index e44f01416bafb78d84db0fd5809296125f32102b..b2949c3905c01bc5c54cd723388f86fe93cae4ee 100644 (file)
@@ -1319,9 +1319,18 @@ scan_content (CT ct, size_t maxunencoded)
     }
 
     /*
     }
 
     /*
-     * Decide what to check while scanning this content.
+     * Decide what to check while scanning this content.  Note that
+     * for text content we always check for 8bit characters if the
+     * charset is unspecified, because that controls whether or not the
+     * character set is us-ascii or retrieved from the locale.
      */
 
      */
 
+    if (ct->c_type == CT_TEXT) {
+       t = (struct text *) ct->c_ctparams;
+       if (t->tx_charset == CHARSET_UNSPECIFIED)
+           check8bit = 1;
+    }
+
     switch (ct->c_reqencoding) {
     case CE_8BIT:
        checkllinelen = 1;
     switch (ct->c_reqencoding) {
     case CE_8BIT:
        checkllinelen = 1;
@@ -1331,14 +1340,12 @@ scan_content (CT ct, size_t maxunencoded)
        checkboundary = 1;
        break;
     case CE_BASE64:
        checkboundary = 1;
        break;
     case CE_BASE64:
-       /* We check nothing here */
        break;
     case CE_UNKNOWN:
        /* Use the default rules based on content-type */
        switch (ct->c_type) {
        case CT_TEXT:
            checkboundary = 1;
        break;
     case CE_UNKNOWN:
        /* Use the default rules based on content-type */
        switch (ct->c_type) {
        case CT_TEXT:
            checkboundary = 1;
-           check8bit = 1;
            checklinelen = 1;
            if (ct->c_subtype == TEXT_PLAIN) {
                checklinespace = 0;
            checklinelen = 1;
            if (ct->c_subtype == TEXT_PLAIN) {
                checklinespace = 0;
@@ -1450,6 +1457,34 @@ scan_content (CT ct, size_t maxunencoded)
        fclose (in);
     }
 
        fclose (in);
     }
 
+    /*
+     * If the content is text and didn't specify a character set,
+     * we need to figure out which one was used.
+     */
+
+    if (ct->c_type == CT_TEXT) {
+       t = (struct text *) ct->c_ctparams;
+       if (t->tx_charset == CHARSET_UNSPECIFIED) {
+           CI ci = &ct->c_ctinfo;
+           char **ap, **ep;
+
+           for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++)
+               continue;
+
+           if (contains8bit) {
+               *ap = concat ("charset=", write_charset_8bit(), NULL);
+           } else {
+               *ap = add ("charset=us-ascii", NULL);
+           }
+           t->tx_charset = CHARSET_SPECIFIED;
+
+           cp = strchr(*ap++, '=');
+           *ap = NULL;
+           *cp++ = '\0';
+           *ep = cp;
+       }
+    }
+
     /*
      * Decide which transfer encoding to use.
      */
     /*
      * Decide which transfer encoding to use.
      */
@@ -1459,31 +1494,6 @@ scan_content (CT ct, size_t maxunencoded)
     else
        switch (ct->c_type) {
        case CT_TEXT:
     else
        switch (ct->c_type) {
        case CT_TEXT:
-           /*
-            * If the text content didn't specify a character
-            * set, we need to figure out which one was used.
-            */
-           t = (struct text *) ct->c_ctparams;
-           if (t->tx_charset == CHARSET_UNSPECIFIED) {
-               CI ci = &ct->c_ctinfo;
-               char **ap, **ep;
-
-               for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++)
-                   continue;
-
-               if (contains8bit) {
-                   *ap = concat ("charset=", write_charset_8bit(), NULL);
-               } else {
-                   *ap = add ("charset=us-ascii", NULL);
-               }
-               t->tx_charset = CHARSET_SPECIFIED;
-
-               cp = strchr(*ap++, '=');
-               *ap = NULL;
-               *cp++ = '\0';
-               *ep = cp;
-           }
-
            if (contains8bit && !linelen && !linespace && !checksw)
                ct->c_encoding = CE_8BIT;
            else if (contains8bit || linelen || linespace || checksw)
            if (contains8bit && !linelen && !linespace && !checksw)
                ct->c_encoding = CE_8BIT;
            else if (contains8bit || linelen || linespace || checksw)