commit ed574e9: [Minor] Try slightly different approach when looking charset aliases

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Jun 2 12:14:08 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-06-02 13:06:40 +0100
URL: https://github.com/rspamd/rspamd/commit/ed574e92254bcf9994aae909707c66371659fddc

[Minor] Try slightly different approach when looking charset aliases

---
 src/libmime/mime_encoding.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/libmime/mime_encoding.c b/src/libmime/mime_encoding.c
index 36c37f10b..a44eb755c 100644
--- a/src/libmime/mime_encoding.c
+++ b/src/libmime/mime_encoding.c
@@ -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);
 


More information about the Commits mailing list