# HG changeset patch # User Yoshiki Yazawa # Date 1210060263 0 # Node ID b8f28a250c22aeda9ebc652e8b51e32d459e67f1 # Parent 61a7929a97b538cf95d5deb6157963380f9a0c59 prepending BOM to selection data produces garbage in almost all cases. diff -r 61a7929a97b5 -r b8f28a250c22 pidgin/gtkimhtml.c --- a/pidgin/gtkimhtml.c Thu May 01 15:24:43 2008 +0000 +++ b/pidgin/gtkimhtml.c Tue May 06 07:51:03 2008 +0000 @@ -932,16 +932,33 @@ } 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); 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); + 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), 8, (const guchar *)selection, strlen(selection)); + gtk_selection_data_set(selection_data, gdk_atom_intern("HTML Format", FALSE), + 8, (const guchar *)selection, strlen(selection)); #endif g_free(selection); } else {