Hi,
I'm migrating an application to Python 3, GTK+ 3 and the PyGI bindings.
I'm having trouble inserting non-ASCII text to a Gtk.TextBuffer. Here's
a minimal example.
#!/usr/bin/env python3
from gi.repository import Gtk
text_view = Gtk.TextView()
text_buffer = text_view.get_buffer()
text_buffer.set_text("åäö")
text_buffer.insert_at_cursor("åäö")
window = Gtk.Window()
window.add(text_view)
window.resize(500, 500)
window.show_all()
window.connect("delete-event", Gtk.main_quit)
Gtk.main()
The 'set_text' call seems to always succeed, but the the following
'insert_at_cursor' call fails with
Gtk-CRITICAL **: gtk_text_buffer_emit_insert: assertion
`g_utf8_validate (text, len, NULL)' failed
The same is true of the other 'insert_*' methods. Strangely trying to
insert "åäö." instead of "åäö" doesn't give a warning, but doesn't
insert the period.
Is this related to the string type changes in Python 2->3? Can I expect
Python 3 and non-ASCII text to work in general with PyGI? I'm using
Python 3.2 and PyGObject 2.28.6 on Debian unstable/experimental.
--
Osmo Salomaa <[email protected]>
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/