pidgin/gtkimhtml.c

changeset 23330
67bcacd6ece9
parent 23310
e34473be13db
child 23332
3911f16f4d0c
equal deleted inserted replaced
23329:a3348556c57d 23330:67bcacd6ece9
999 999
1000 if (info == TARGET_HTML) { 1000 if (info == TARGET_HTML) {
1001 char *selection; 1001 char *selection;
1002 #ifndef _WIN32 1002 #ifndef _WIN32
1003 gsize len; 1003 gsize len;
1004 GString *str = g_string_new(NULL);
1005 if (primary) { 1004 if (primary) {
1006 text = gtk_imhtml_get_markup_range(imhtml, &start, &end); 1005 text = gtk_imhtml_get_markup_range(imhtml, &start, &end);
1007 } else 1006 } else
1008 text = html_clipboard; 1007 text = html_clipboard;
1009 1008
1010 /* Mozilla asks that we start our text/html with the Unicode byte order mark */ 1009 /* Mozilla asks that we start our text/html with the Unicode byte order mark */
1011 str = g_string_append_unichar(str, 0xfeff); 1010 selection = g_convert(text, -1, "UTF-16", "UTF-8", NULL, &len, NULL);
1012 str = g_string_append(str, text);
1013 str = g_string_append_unichar(str, 0x0000);
1014 selection = g_convert(str->str, str->len, "UTF-16", "UTF-8", NULL, &len, NULL);
1015 gtk_selection_data_set(selection_data, gdk_atom_intern("text/html", FALSE), 16, (const guchar *)selection, len); 1011 gtk_selection_data_set(selection_data, gdk_atom_intern("text/html", FALSE), 16, (const guchar *)selection, len);
1016 g_string_free(str, TRUE);
1017 #else 1012 #else
1018 selection = clipboard_html_to_win32(html_clipboard); 1013 selection = clipboard_html_to_win32(html_clipboard);
1019 gtk_selection_data_set(selection_data, gdk_atom_intern("HTML Format", FALSE), 8, (const guchar *)selection, strlen(selection)); 1014 gtk_selection_data_set(selection_data, gdk_atom_intern("HTML Format", FALSE), 8, (const guchar *)selection, strlen(selection));
1020 #endif 1015 #endif
1021 g_free(selection); 1016 g_free(selection);

mercurial