From: Thomas Roessler Date: Thu, 7 Sep 2000 21:03:20 +0000 (+0000) Subject: Detect pure 7bit data and don't encode them. This helps a bit in X-Git-Tag: mutt-1-3-9-rel~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=748623e03aea967ef6096543d9e2a6a682c5fd93;p=mutt Detect pure 7bit data and don't encode them. This helps a bit in situations where mutt believes it has some really strange us-ascii alias as the character set. --- diff --git a/rfc2231.c b/rfc2231.c index 673a2191..f2d01bd5 100644 --- 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)))