summaryrefslogtreecommitdiffstats
path: root/libraries/libvmime-zarafa/patches/vmime-mixed-qp-in-parameter.diff
blob: 78e6c70e493a25d0f07d2fbb14a28e6deefee7b0 (plain)
Index: svn/src/parameter.cpp
===================================================================
--- svn/src/parameter.cpp	(revision 597)
+++ svn/src/parameter.cpp	(working copy)
@@ -239,8 +239,21 @@
 			{
 				value << t.getWholeBuffer();
 
-				if (!foundCharsetChunk)
-					ch = t.getWordAt(0)->getCharset();
+				if (!foundCharsetChunk) {
+					// this is still wrong. each word can have it's
+					// own charset, and can be mixed (eg. iso-8859-1
+					// and iso-2022-jp), but very unlikely.
+					// real fix is to have parameters store a
+					// vmime::text in stead of a vmime::word in
+					// m_value.  but that changes the interface
+					for (size_t i = 0; i < t.getWordCount(); i++) {
+						if (t.getWordAt(i)->getCharset() != ch && ch == charsets::US_ASCII) {
+							ch = t.getWordAt(i)->getCharset();
+							break;
+						}
+					}
+						
+				}
 			}
 		}
 	}