[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mozilla-gtk
Subject:    Re: Mozilla selections question
From:       Havoc Pennington <hp () redhat ! com>
Date:       2002-05-31 19:40:27
[Download RAW message or body]


Philip <freax@pandora.be> writes: 
> My next question is.. what is the best way to convert this UCS2 string to
> a format that I can use in Gnome/Gtk+ applications? (example : I
> want to
> show the string in a GtkTextView/GtkText widget.)

guint16 *ucs2 = selection_data->data;
int i;
GString *str;

str = g_string_new (NULL);
i = 0;
while (i < selection_data->length / 2)
  {
    g_string_append_unichar (str, ucs2[i]);

    ++i;
  }

return g_string_free (str, FALSE);

Or something like that.

> OpenOffice.org also has a "text/html" target. This results in a correct
> string. So won't this create an incosistent protocol? In application a it
> gives me an UCS2 string, in application b it's a normal one :-\

Yes, this means you are fucked and one of the apps is broken. Just
accept not working with the broken one, and file a bug to get it
fixed.

Havoc

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic