comparison src/gtkimhtml.c @ 8909:87e171358001

[gaim-migrate @ 9679] (21:39:11) marv: LSchiere2: this strips the BOM from the inserted pasted text, while keeping it around during the conversation, thus making marcus's patch more better committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 09 May 2004 01:39:42 +0000
parents 00138e366ef8
children 73223e21b943
comparison
equal deleted inserted replaced
8908:a9ad52960c1c 8909:87e171358001
761 } 761 }
762 762
763 if (selection_data->length >= 2 && 763 if (selection_data->length >= 2 &&
764 (*(guint16 *)text == 0xfeff || *(guint16 *)text == 0xfffe)) { 764 (*(guint16 *)text == 0xfeff || *(guint16 *)text == 0xfffe)) {
765 /* This is UCS-2 */ 765 /* This is UCS-2 */
766 char *tmp;
766 char *utf8 = g_convert(text, selection_data->length, "UTF-8", "UCS-2", NULL, NULL, NULL); 767 char *utf8 = g_convert(text, selection_data->length, "UTF-8", "UCS-2", NULL, NULL, NULL);
767 g_free(text); 768 g_free(text);
768 text = utf8; 769 text = utf8;
769 if (!text) { 770 if (!text) {
770 gaim_debug_warning("gtkimhtml", "g_convert from UCS-2 failed in paste_received_cb\n"); 771 gaim_debug_warning("gtkimhtml", "g_convert from UCS-2 failed in paste_received_cb\n");
771 return; 772 return;
772 } 773 }
774 tmp = g_utf8_next_char(text);
775 memmove(text, tmp, strlen(tmp) + 1);
773 } 776 }
774 777
775 if (!(*text) || !g_utf8_validate(text, -1, NULL)) { 778 if (!(*text) || !g_utf8_validate(text, -1, NULL)) {
776 gaim_debug_warning("gtkimhtml", "empty string or invalid UTF-8 in paste_received_cb\n"); 779 gaim_debug_warning("gtkimhtml", "empty string or invalid UTF-8 in paste_received_cb\n");
777 g_free(text); 780 g_free(text);