[PATCH 7/7] Parse properly rfc2047 word in utf-8



---
 ChangeLog                                          |    1 +
 .../camel-lite/camel/camel-mime-utils.c            |    9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f2aa25d..ca4e830 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
 	* Refactor decode_it and decode_it_2 in _tny_camel_decode_raw_header
 	* Decode properly headers in TnyCamelBsMsgHeader, to return utf8
 	strings.
+	* Fix decoding of rfc2047 strings in utf8 in some cases.
 
 2009-12-11  Sergio Villar Senin  <svillar igalia com>
 
diff --git a/libtinymail-camel/camel-lite/camel/camel-mime-utils.c b/libtinymail-camel/camel-lite/camel/camel-mime-utils.c
index a73e92b..b2a8a96 100644
--- a/libtinymail-camel/camel-lite/camel/camel-mime-utils.c
+++ b/libtinymail-camel/camel-lite/camel/camel-mime-utils.c
@@ -1104,15 +1104,18 @@ rfc2047_decode_word (const char *in, size_t inlen, const char *default_charset)
 
 	/* slight optimization? */
 	if (!g_ascii_strcasecmp (charset, "UTF-8")) {
-		p = (char *) decoded;
-		len = declen;
+		char *str_8bit;
+
+		str_8bit = decode_8bit ((char *) decoded, declen, default_charset);
+		p = (char *) str_8bit;
+		len = strlen (str_8bit);
 		
 		while (!g_utf8_validate (p, len, (const char **) &p)) {
 			len = declen - (p - (char *) decoded);
 			*p = '?';
 		}
 		
-		return g_strndup ((char *) decoded, declen);
+		return str_8bit;
 	}
 	
 	if (charset[0])
-- 
1.6.3.3


--=-7xSGRSdHbBXdNvov60N6--



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]