File vmime-mixed-qp-in-parameter.diff of Package libvmime_zarafa7

---
 src/parameter.cpp |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Index: vmime/src/parameter.cpp
===================================================================
--- vmime.orig/src/parameter.cpp
+++ vmime/src/parameter.cpp
@@ -240,7 +240,17 @@ void parameter::parse(const std::vector
 				value << t.getWholeBuffer();
 
 				if (!foundCharsetChunk)
-					ch = t.getWordAt(0)->getCharset();
+					// this is still wrong. each word can have its
+					// 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 instead 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;
+						}
 			}
 		}
 	}
openSUSE Build Service is sponsored by