aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-18 16:30:26 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-18 16:30:26 +0000
commit8f1e31554cfa4e9b9f74f5499c3d446ff155839c (patch)
tree4e9bd8a4cd7435b83be58a54379f31cc70841b5b
parent52773426bf2efd4ee1876690c47ec7114eed19fe (diff)
downloadrspamd-8f1e31554cfa4e9b9f74f5499c3d446ff155839c.tar.gz
rspamd-8f1e31554cfa4e9b9f74f5499c3d446ff155839c.zip
[Fix] Fix charset normalisation
-rw-r--r--src/libmime/mime_encoding.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libmime/mime_encoding.c b/src/libmime/mime_encoding.c
index 6790cd8e6..ca916c015 100644
--- a/src/libmime/mime_encoding.c
+++ b/src/libmime/mime_encoding.c
@@ -104,7 +104,9 @@ rspamd_mime_detect_charset (const rspamd_ftok_t *in, rspamd_mempool_t *pool)
ret = rspamd_mempool_ftokdup (pool, in);
rspamd_charset_normalize (ret);
- if (memchr (in->begin, '-', in->len) != NULL) {
+ if ((in->len > 3 && rspamd_lc_cmp (in->begin, "cp-", 3) == 0) ||
+ (in->len > 4 && (rspamd_lc_cmp (in->begin, "ibm-", 4) == 0 ||
+ rspamd_lc_cmp (in->begin, "iso-", 4) == 0) )) {
/* Try to remove '-' chars from encoding: e.g. CP-100 to CP100 */
h = ret;
t = ret;