X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/93e71b55fbdd0fd55d544abf90ad27e5922b1601..2bd2ea37d43ab626c0139f1fc4d0bdfb23970b03:/uip/mhbuildsbr.c diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 910d3b23..cf7c53ac 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -474,6 +474,7 @@ init_decoded_content (CT ct, const char *filename) ct->c_ceopenfnx = open7Bit; /* since unencoded */ ct->c_ceclosefnx = close_encoding; ct->c_cesizefnx = NULL; /* since unencoded */ + ct->c_encoding = CE_7BIT; /* Seems like a reasonable default */ ct->c_file = add(filename, NULL); return OK; @@ -1359,15 +1360,17 @@ scan_content (CT ct, size_t maxunencoded) break; case CT_MESSAGE: - check8bit = 0; checklinelen = 0; checklinespace = 0; /* don't check anything for message/external */ - if (ct->c_subtype == MESSAGE_EXTERNAL) + if (ct->c_subtype == MESSAGE_EXTERNAL) { checkboundary = 0; - else + check8bit = 0; + } else { checkboundary = 1; + check8bit = 1; + } break; case CT_AUDIO: @@ -1404,6 +1407,7 @@ scan_content (CT ct, size_t maxunencoded) if (!isascii ((unsigned char) *cp)) { contains8bit = 1; check8bit = 0; /* no need to keep checking */ + break; } } } @@ -1497,7 +1501,7 @@ scan_content (CT ct, size_t maxunencoded) break; case CT_MESSAGE: - ct->c_encoding = CE_7BIT; + ct->c_encoding = contains8bit ? CE_8BIT : CE_7BIT; break; case CT_AUDIO: @@ -1659,9 +1663,6 @@ skip_headers: break; case CE_8BIT: - if (ct->c_type == CT_MESSAGE) - adios (NULL, "internal error, invalid encoding"); - np = add (ENCODING_FIELD, NULL); vp = concat (" ", "8bit", "\n", NULL); add_header (ct, np, vp);