]> granicus.if.org Git - mutt/commitdiff
Detect pure 7bit data and don't encode them. This helps a bit in
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 7 Sep 2000 21:03:20 +0000 (21:03 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 7 Sep 2000 21:03:20 +0000 (21:03 +0000)
situations where mutt believes it has some really strange us-ascii
alias as the character set.

rfc2231.c

index 673a2191961a23634922efc7d266293e99add0c4..f2d01bd570568f4b80dbf70a9567326f67434345 100644 (file)
--- a/rfc2231.c
+++ b/rfc2231.c
@@ -308,9 +308,20 @@ int rfc2231_encode_string (char **pd)
   char *charset, *s, *t, *e, *d = 0;
   size_t slen, dlen = 0;
 
-  if (!*pd)
+  /* 
+   * A shortcut to detect pure 7bit data.
+   * 
+   * This should prevent the worst when character set handling
+   * is flawed.
+   */
+
+  for (s = *pd; *s; s++)
+    if (*s & 0x80)
+      break;
+  
+  if (!*s)
     return 0;
-
+  
   if (!Charset || !SendCharset ||
       !(charset = mutt_choose_charset (Charset, SendCharset,
                                  *pd, strlen (*pd), &d, &dlen)))