]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Try slightly different approach when looking charset aliases
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 2 Jun 2020 12:06:40 +0000 (13:06 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 2 Jun 2020 12:06:40 +0000 (13:06 +0100)
src/libmime/mime_encoding.c

index 36c37f10b4dd6e8766e780208823f46687d5f749..a44eb755c0f014663ec96d8039e320815799436f 100644 (file)
@@ -301,7 +301,7 @@ rspamd_mime_detect_charset (const rspamd_ftok_t *in, rspamd_mempool_t *pool)
                ret = (char *)s->canon;
        }
 
-       /* Just fucking stupid */
+       /* Try different aliases */
        cset = ucnv_getCanonicalName (ret, "MIME", &uc_err);
 
        if (cset == NULL) {
@@ -311,12 +311,12 @@ rspamd_mime_detect_charset (const rspamd_ftok_t *in, rspamd_mempool_t *pool)
 
        if (cset == NULL) {
                uc_err = U_ZERO_ERROR;
-               cset = ucnv_getCanonicalName (ret, "WINDOWS", &uc_err);
+               cset = ucnv_getCanonicalName (ret, "", &uc_err);
        }
 
        if (cset == NULL) {
                uc_err = U_ZERO_ERROR;
-               cset = ucnv_getCanonicalName (ret, "JAVA", &uc_err);
+               cset = ucnv_getAlias (ret, 0, &uc_err);
        }
 
        return cset;
@@ -389,7 +389,7 @@ rspamd_mime_text_to_utf8 (rspamd_mempool_t *pool,
                return NULL;
        }
 
-       msg_info_pool ("converted from %s to UTF-8 inlen: %z, outlen: %d",
+       msg_debug_pool ("converted from %s to UTF-8 inlen: %z, outlen: %d",
                        in_enc, len, r);
        g_free (tmp_buf);