Index: src/xmlformat-common.c
===================================================================
--- src/xmlformat-common.c	(revision 5870)
+++ src/xmlformat-common.c	(working copy)
@@ -227,6 +227,36 @@
 	vformat_attribute_add_value(attr, tmp);
 }
 
+void add_value_array(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *parameterNameArray[], int nParameters, const char *encoding) {
+	const char **parameterValueArray = malloc(nParameters*sizeof(char*));
+	int n=-1;
+	int i;
+	for (i=0; i<nParameters; ++i) {
+		parameterValueArray[i]=osync_xmlfield_get_key_value(xmlfield, parameterNameArray[i]);
+		if (parameterValueArray[i]) n=i;
+	}
+	for (i=0; i<=n; ++i) {
+		const char *name = parameterNameArray[i];
+		const char *tmp = parameterValueArray[i];
+		if (needs_charset((unsigned char*)tmp))
+			if (!vformat_attribute_has_param (attr, "CHARSET"))
+				vformat_attribute_add_param_with_value(attr, "CHARSET", "UTF-8");
+	
+		/* XXX: This one breaks unit test case: conv_vcard_evolution2_special
+		   TODO: Combine this with converter extension/config ... e.g. if a mobile needs QP!
+		*/        
+		if (needs_encoding((unsigned char*)tmp, encoding)) {
+			if (!vformat_attribute_has_param (attr, "ENCODING"))
+				vformat_attribute_add_param_with_value(attr, "ENCODING", encoding);
+			vformat_attribute_add_value_decoded(attr, tmp, strlen(tmp) + 1);
+		} else
+		vformat_attribute_add_value(attr, tmp);
+
+	}
+	free(parameterValueArray);
+}
+
+
 void add_values(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *encoding)
 {
 	int i, c = osync_xmlfield_get_key_count(xmlfield);
Index: src/xmlformat-common.h
===================================================================
--- src/xmlformat-common.h	(revision 5870)
+++ src/xmlformat-common.h	(working copy)
@@ -71,6 +71,7 @@
 osync_bool needs_charset(const unsigned char *tmp);
 
 void add_value(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *name, const char *encoding);
+void add_value_array(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *parameterNameArray[], int nParameters, const char *encoding);
 void add_values(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *encoding);
 void add_values_from_nth_field_on(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *encoding, int nth);
 
Index: src/xmlformat-vcard.c
===================================================================
--- src/xmlformat-vcard.c	(revision 5870)
+++ src/xmlformat-vcard.c	(working copy)
@@ -1466,15 +1466,13 @@
 	return attr;
 }
 
+static const char* xml_name_parameters[] = { "LastName", "FirstName", "Additional", "Prefix", "Suffix"};
+
 static VFormatAttribute *handle_xml_name_attribute(VFormat *vcard, OSyncXMLField *xmlfield, const char *encoding)
 {
 	osync_trace(TRACE_INTERNAL, "Handling name xml attribute");
 	VFormatAttribute *attr = vformat_attribute_new(NULL, "N");
-	add_value(attr, xmlfield, "LastName", encoding);
-	add_value(attr, xmlfield, "FirstName", encoding);
-	add_value(attr, xmlfield, "Additional", encoding);
-	add_value(attr, xmlfield, "Prefix", encoding);
-	add_value(attr, xmlfield, "Suffix", encoding);
+	add_value_array(attr, xmlfield, xml_name_parameters, 5, encoding);
 	vformat_add_attribute(vcard, attr);
 	return attr;
 }


