Mercurial > pidgin.yaz
changeset 8869:ab5a46dd132a
[gaim-migrate @ 9637]
Copy/paste fixes for UCS-2 encoded selections
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Tue, 04 May 2004 06:08:47 +0000 |
parents | db80183f251c |
children | 9e33e1fa6c97 |
files | ChangeLog src/gtkimhtml.c |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon May 03 18:34:08 2004 +0000 +++ b/ChangeLog Tue May 04 06:08:47 2004 +0000 @@ -22,6 +22,7 @@ * Gtk2.0 compatibility fixes (Tim Ringenbach) * Updated and standardized blist signals (Gary Kramlich) * More doxygen fixes (Jonathan Champ) + * Copy/paste encoding fixes (Joe Marcus Clarke) version 0.77 (04/22/2004): New Features:
--- a/src/gtkimhtml.c Mon May 03 18:34:08 2004 +0000 +++ b/src/gtkimhtml.c Tue May 04 06:08:47 2004 +0000 @@ -689,7 +689,6 @@ static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *selection_data, gpointer data) { char *text; - guint16 c; GtkIMHtml *imhtml = data; GtkTextIter iter; GtkIMHtmlOptions flags = GTK_IMHTML_NO_NEWLINE; @@ -761,14 +760,14 @@ memcpy(text, selection_data->data, selection_data->length); } - memcpy (&c, text, 2); - if (c == 0xfeff) { - /* This is UCS2 */ - char *utf8 = g_convert(text+2, selection_data->length - 2, "UTF-8", "UCS-2", NULL, NULL, NULL); + if (selection_data->length >= 2 && + (*(guint16 *)text == 0xfeff || *(guint16 *)text == 0xfffe)) { + /* This is UCS-2 */ + char *utf8 = g_convert(text, selection_data->length, "UTF-8", "UCS-2", NULL, NULL, NULL); g_free(text); text = utf8; if (!text) { - gaim_debug_warning("gtkimhtml", "g_convert failed in paste_received_cb\n"); + gaim_debug_warning("gtkimhtml", "g_convert from UCS-2 failed in paste_received_cb\n"); return; } }