dovecot-2.2: lib-mail: Message decoder now runs normalizer also ...

dovecot at dovecot.org dovecot at dovecot.org
Thu Sep 11 13:40:35 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/bbf760c25a9e
changeset: 17792:bbf760c25a9e
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 11 16:40:00 2014 +0300
description:
lib-mail: Message decoder now runs normalizer also for unknown charsets.

diffstat:

 src/lib-mail/message-decoder.c |  14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)

diffs (31 lines):

diff -r ef55b00eef2a -r bbf760c25a9e src/lib-mail/message-decoder.c
--- a/src/lib-mail/message-decoder.c	Thu Sep 11 16:14:24 2014 +0300
+++ b/src/lib-mail/message-decoder.c	Thu Sep 11 16:40:00 2014 +0300
@@ -334,7 +334,9 @@
 	if (ctx->binary_input) {
 		output->data = data;
 		output->size = size;
-	} else if (ctx->charset_utf8) {
+	} else if (ctx->charset_utf8 || ctx->charset_trans == NULL) {
+		/* handle unknown charsets the same as UTF-8. it might find
+		   usable ASCII text. */
 		buffer_set_used_size(ctx->buf2, 0);
 		if (ctx->normalizer != NULL) {
 			(void)ctx->normalizer(data, size, ctx->buf2);
@@ -347,16 +349,6 @@
 			output->data = ctx->buf2->data;
 			output->size = ctx->buf2->used;
 		}
-	} else if (ctx->charset_trans == NULL) {
-		/* unknown charset */
-		buffer_set_used_size(ctx->buf2, 0);
-		if (uni_utf8_get_valid_data(data, size, ctx->buf2)) {
-			output->data = data;
-			output->size = size;
-		} else {
-			output->data = ctx->buf2->data;
-			output->size = ctx->buf2->used;
-		}
 	} else {
 		buffer_set_used_size(ctx->buf2, 0);
 		if (ctx->translation_size != 0)


More information about the dovecot-cvs mailing list