From: Vsevolod Stakhov Date: Mon, 18 Nov 2019 20:39:15 +0000 (+0000) Subject: [Minor] Look also for mime charset X-Git-Tag: 2.2~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=452541a054bc36557d847f7b9bfe70d4442eccf1;p=rspamd.git [Minor] Look also for mime charset --- diff --git a/src/libmime/mime_encoding.c b/src/libmime/mime_encoding.c index c3f69edbd..f7a244d0c 100644 --- a/src/libmime/mime_encoding.c +++ b/src/libmime/mime_encoding.c @@ -239,6 +239,7 @@ rspamd_mime_detect_charset (const rspamd_ftok_t *in, rspamd_mempool_t *pool) { gchar *ret = NULL, *h, *t; struct rspamd_charset_substitution *s; + const gchar *cset; UErrorCode uc_err = U_ZERO_ERROR; if (sub_hash == NULL) { @@ -271,7 +272,13 @@ rspamd_mime_detect_charset (const rspamd_ftok_t *in, rspamd_mempool_t *pool) return ucnv_getStandardName (s->canon, "IANA", &uc_err); } - return ucnv_getStandardName (ret, "IANA", &uc_err); + cset = ucnv_getStandardName (ret, "IANA", &uc_err); + + if (cset == NULL) { + cset = ucnv_getStandardName (ret, "MIME", &uc_err); + } + + return cset; } gchar *