]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow ascii messages with undetected charset
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 23 Feb 2017 16:20:50 +0000 (16:20 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 23 Feb 2017 16:20:50 +0000 (16:20 +0000)
src/libmime/mime_encoding.c

index 59df89ece331d88d08eef7c36943545ef318e751..a9ddb42fa19d0400c17aa24a665bdf93187ceedc 100644 (file)
@@ -392,6 +392,17 @@ rspamd_mime_charset_find_by_content (gchar *in, gsize inlen)
                g_assert (csd != NULL);
        }
 
+       /* If text is ascii, then we can treat it as utf8 data */
+       for (i = 0; i < inlen; i++) {
+               if ((((guchar)in[i]) & 0x80) != 0) {
+                       goto detect;
+               }
+       }
+
+       return UTF8_CHARSET;
+
+detect:
+
        ucsdet_setText (csd, in, inlen, &uc_err);
        csm = ucsdet_detectAll(csd, &matches, &uc_err);