pidgin: da43d671: Do not prepend the BOM when converting f...

sadrul at pidgin.im sadrul at pidgin.im
Sun May 25 19:51:13 EDT 2008


-----------------------------------------------------------------
Revision: da43d67131d318f67d21afc95a349c3ab8ef8c92
Ancestor: 886c30a3d3006c7497f9e6ce6354ba660e5505bd
Author: sadrul at pidgin.im
Date: 2008-05-25T23:46:19
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/da43d67131d318f67d21afc95a349c3ab8ef8c92

Modified files:
        pidgin/gtkimhtml.c

ChangeLog: 

Do not prepend the BOM when converting from UTF-8 to UTF-16, since
g_convert seems to do that for us. Closes #5915. Fixes #5515.

-------------- next part --------------
============================================================
--- pidgin/gtkimhtml.c	731b0418f2c6876b8ec34446b0e84672898cb9d0
+++ pidgin/gtkimhtml.c	c042866e73ba95ded216cfd84344731a793dc9a2
@@ -1001,19 +1001,14 @@ static void gtk_imhtml_clipboard_get(Gtk
 		char *selection;
 #ifndef _WIN32
 		gsize len;
-		GString *str = g_string_new(NULL);
 		if (primary) {
 			text = gtk_imhtml_get_markup_range(imhtml, &start, &end);
 		} else
 			text = html_clipboard;
 
 		/* 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);
-		selection = g_convert(str->str, str->len, "UTF-16", "UTF-8", NULL, &len, NULL);
+		selection = g_convert(text, -1, "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
 		selection = clipboard_html_to_win32(html_clipboard);
 		gtk_selection_data_set(selection_data, gdk_atom_intern("HTML Format", FALSE), 8, (const guchar *)selection, strlen(selection));


More information about the Commits mailing list