Index: addressbook/libebook/e-vcard.c
===================================================================
--- addressbook/libebook/e-vcard.c	(revision 7724)
+++ addressbook/libebook/e-vcard.c	(working copy)
@@ -809,7 +809,7 @@
 		GList *p;
 		EVCardAttribute *attr = l->data;
 		GString *attr_str;
-		int l;
+		int len;
 
 		if (!g_ascii_strcasecmp (attr->name, "VERSION"))
 			continue;
@@ -885,21 +885,45 @@
 		 * When generating a content line, lines longer than 75
 		 * characters SHOULD be folded
 		 */
-		l = 0;
-		do {
-			
-			if ((g_utf8_strlen (attr_str->str, -1) -l) > 75) {
-				char *p;
+		len = g_utf8_strlen (attr_str->str, -1);
 
-				l += 75;
-				p = g_utf8_offset_to_pointer (attr_str->str, l);
-			
-				g_string_insert_len (attr_str, (p - attr_str->str), CRLF " ", sizeof (CRLF " ") - 1);
-			}
-			else
-				break;
-		} while (l < g_utf8_strlen (attr_str->str, -1));
+		if ( len>75 ){
+			int l, move_part;
+			GString *str;
+			gchar *p;
 
+			l = 0;
+			move_part=75;
+
+			p = attr_str->str;
+			str = g_string_sized_new (attr_str->len + (1 + (len-75)/72)*( g_utf8_strlen (CRLF " ", -1) ) + 1);
+
+			do {
+
+				if (len - l > 75) {
+					gchar *q;
+
+					q = g_utf8_offset_to_pointer (p, move_part);
+					
+					g_string_append_len (str, p, q-p );
+					g_string_append (str, CRLF " ");
+
+					l += move_part;
+					p = q;
+
+					/* to make same output like previous algorithm */
+					move_part=72;
+				}
+				else {
+					g_string_append (str, p);
+					break;
+				}
+			} while (l < len);
+		
+			g_string_free (attr_str, TRUE);
+			attr_str = str;
+		}
+
 		g_string_append (attr_str, CRLF);
 
 		g_string_append (str, attr_str->str);
Index: addressbook/ChangeLog
===================================================================
--- addressbook/ChangeLog	(revision 7724)
+++ addressbook/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2007-05-03  Milan Crha   <mcrha@redhat.com>
+
+	** Fix for bug #336574 from Ryan Shea
+	* addressbook/libebook/e-vcard.c (e_vcard_to_string_vcard_30):
+	improved cutting lines longer then 75 chars
+
 2007-04-20  Srinivasa Ragavan  <sragavan@novell.com>
 
 	** Fix for bug #426893 from Caolan McNamara
