Re: make sure clipboard has utf8 text?



Mikael Hermansson <mikeh bahnhof se> writes:

> I don't know if this has been discussed before but how do Gtk2.0 handles
> Clipboard text that is not utf8 format?
> 
> For example I tried to paste some text from an old gtk app to the new
> textview widget and it yells "Invalid UTF8 string passed to
> pango_layout_set_text" 
> but still it inserts it to the textbuffert and then it core dumps.
> 
> IMHO. the clipboard should check if its utf8 text before insertion and if
> not:
> 
> A. convert from current locale to utf8
> B. if A is not possible, remove the illegal  characters (ugly I know)

Are you sure you are using the latest CVS of GTK+ - if you
paste in from a non-UTF-8 aware application, it will convert
from the encoding of the current locale or from latin-1, depending
on the details of the selection received.

If that fails, it should simply complain and not insert the text. 

I did some fairly extensive testing of this, and it seemed/seems
to work fine, though there may be some case that doesn't handle.
What sort of test were you trying to paste? What locale setting?

Regards,
                                        Owen

[ I think there are some more enhancements to this stuf in the
  new-im branch of GTK+ than HEAD; for instance, but as I recall
  HEAD should get the basics of this fine. ]





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]