diff pidgin/gtkimhtml.c @ 27834:8b269348e97b

The last modification to gtk_imhtml_clipboard_get() causes trailing garbage when user pastes from clipboard continuously. So back to UTF-16 for now but do in more sane way.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 07 May 2008 03:32:58 +0000
parents 1dd0e007514d
children d1dfbedd9e64
line wrap: on
line diff
--- a/pidgin/gtkimhtml.c	Tue May 06 07:58:54 2008 +0000
+++ b/pidgin/gtkimhtml.c	Wed May 07 03:32:58 2008 +0000
@@ -962,29 +962,13 @@
 		} else
 			text = html_clipboard;
 
-#if 0
-		/* faulty! it tries to add BOM wrongly. furthermore,
-		 * TARGET_HTML is used in somewhere else than mozilla
-		 * so that blindly adding BOM produces unexpected
-		 * garbage in those places. --yaz */
-
 		/* Mozilla asks that we start our text/html with the Unicode byte order mark */
-		str = g_string_append_unichar(str, 0xfeff);
 		str = g_string_append(str, text);
-		str = g_string_append_unichar(str, 0x0000);
+		str = g_string_append_c(str, 0x00);
 		selection = g_convert(str->str, str->len, "UTF-16", "UTF-8", NULL, &len, NULL);
 		gtk_selection_data_set(selection_data, gdk_atom_intern("text/html", FALSE),
 				       16, (const guchar *)selection, len);
 		g_string_free(str, TRUE);
-#else
-		/* firefox no longer needs BOM. do it simply. --yaz */
-		selection = NULL;
-		g_string_free(str, TRUE);
-
-		gtk_selection_data_set(selection_data, gdk_atom_intern("text/html", FALSE),
-				       8, (const guchar *)text, strlen(text));
-#endif
-
 #else /*_WIN32 */
 		selection = clipboard_html_to_win32(html_clipboard);
 		gtk_selection_data_set(selection_data, gdk_atom_intern("HTML Format", FALSE),