[pygtk] Nul Teminated Strings and Text Buffers

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Thu Jul 1 17:55:37 WST 2004


A Qui, 2004-07-01 às 05:40, Michael JasonSmith escreveu:
> When calling the "insert_with_tags" method of a gtk.TextBuffer I am
> getting errors along the lines of 
>         Gtk-CRITICAL **: file gtktextbuffer.c: line 557
>         (gtk_text_buffer_emit_insert): assertion `g_utf8_validate (text,
>         len, NULL)' failed
> 
> I checked Bugzilla and there appears to be no open bugs relating to the
> gtktextbuffer. By the looks of what appears in the text buffer, the
> string to be is displayed is not nul-terminated, which the error message
> above seems to confirm. I tried to hack around the problem by adding my
> own nul-character to the end of the string, but the bug is too smart for
> that!

  The message above is only saying that your text string is not well
encoded in utf-8.  Just try to use unicode objects instead of strings,
if you're getting these problems, and python will automatically convert
to utf-8 for you.

> 
> Shall I go ahead an submit a bug into Bugzilla, or should I try
> something else first?
-- 
Gustavo João Alves Marques Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic.



More information about the pygtk mailing list