]> granicus.if.org Git - mutt/commitdiff
Don't tag us-ascii headers as $Charset or unknown-8bit.
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 7 Dec 1998 10:05:07 +0000 (10:05 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 7 Dec 1998 10:05:07 +0000 (10:05 +0000)
rfc2047.c

index 806c5f432233e9be382347515ff00eb0e29a9885..a0a37c330ab5c09ddc85e78a15cdb1d8dc465f99 100644 (file)
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -35,9 +35,20 @@ static void q_encode_string (char *d, size_t dlen, const unsigned char *s)
   char charset[SHORT_STRING];
   size_t cslen, wordlen;
   char *wptr = d;
+  const unsigned char *t;
+  int hibit = 0;
+
+  for(t = s; *t && !hibit; t++)
+    if(*t & 0x80) hibit = 1;
+
+  if(hibit)
+  {
+    snprintf (charset, sizeof (charset), "=?%s?Q?",
+             mutt_strcasecmp ("us-ascii", Charset) == 0 ? "unknown-8bit" : NONULL(Charset));
+  }
+  else
+    strfcpy(charset, "=?us-ascii?Q?", sizeof(charset));
 
-  snprintf (charset, sizeof (charset), "=?%s?Q?",
-           mutt_strcasecmp ("us-ascii", Charset) == 0 ? "unknown-8bit" : NONULL(Charset));
   cslen = mutt_strlen (charset);
 
   strcpy (wptr, charset);