changeset 8842:96102e6cd333 HEAD

Charset conversion: Don't panic if iconv() doesn't produce valid UTF-8 output.
author Timo Sirainen <tss@iki.fi>
date Thu, 19 Mar 2009 18:19:56 -0400
parents ea833e894759
children 747a0c3199bf
files src/lib-charset/charset-iconv.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-charset/charset-iconv.c	Thu Mar 19 17:06:33 2009 -0400
+++ b/src/lib-charset/charset-iconv.c	Thu Mar 19 18:19:56 2009 -0400
@@ -117,9 +117,10 @@
 	} else {
 		size_t tmpsize = sizeof(tmpbuf) - destleft;
 
-		/* we just converted data to UTF-8, it can't be invalid */
-		if (uni_utf8_to_decomposed_titlecase(tmpbuf, tmpsize, dest) < 0)
-			i_unreached();
+		/* we just converted data to UTF-8. it shouldn't be invalid,
+		   but Solaris iconv appears to pass invalid data through
+		   sometimes (e.g. 8 bit characters with UTF-7) */
+		(void)uni_utf8_to_decomposed_titlecase(tmpbuf, tmpsize, dest);
 	}
 	return ret;
 }