[Pidgin] #5915: BOM with g_convert
Pidgin
trac at pidgin.im
Sat May 24 23:04:41 EDT 2008
#5915: BOM with g_convert
--------------------------+-------------------------------------------------
Reporter: sadrul | Owner: elb
Type: defect | Status: new
Priority: minor | Milestone:
Component: pidgin (gtk) | Version: 2.4.2
Keywords: | Pending: 0
--------------------------+-------------------------------------------------
It looks like g_convert always adds the BOM at the beginning when
converting from UTF-8 to UTF-16. That's not the case for conversion from
UTF-8 to UCS-2, though, which is what we used to do. Therefore, it looks
like it's no longer necessary to prepend the BOM ourselves.
{{{
============================================================
--- 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));
}}}
This seems to fix the issue of BOM being included in a copy/paste in
pidgin.
--
Ticket URL: <http://developer.pidgin.im/ticket/5915>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list