Re: [pygtk] utf8 validating string

2007-12-03 Thread Yann Leboulanger
John Ehresman wrote: Yann Leboulanger wrote: I'd like not to have it. But I getthis string by gpg-decodding a message send by Miranda IM. I think it's a bug in their GnuPG implementation, but anyway I'd like my client to detect those bad string and a) print message correctly if I can or b)

Re: [pygtk] utf8 validating string

2007-12-03 Thread Yann Leboulanger
John Ehresman wrote: I'm confused here; I think your last example passes '\x0' to a gtk function which does not work. Either remove the '\x0' or do something else with \x0 here. Or am I missing something? removeing the \x0 isn't a problem, a replce can do that, but is it the only char that

Re: [pygtk] utf8 validating string

2007-11-30 Thread Yann Leboulanger
John Ehresman wrote: Yann Leboulanger wrote: Hi, I have a string that a textview can't display. It contains invalid chars: t = Let's check this out.\x00 import gtk tv = gtk.TextView() b = tv.get_buffer() b.set_text(t) __main__:1: GtkWarning: gtk_text_buffer_emit_insert: assertion

Re: [pygtk] utf8 validating string

2007-11-30 Thread John Ehresman
Yann Leboulanger wrote: import gtk tv = gtk.TextView() b = tv.get_buffer() t = Let's check this out.\x00 u = unicode(t, 'utf-8') b.set_text(t) __main__:1: GtkWarning: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)' failed but b.set_text(u) works ... is it the way to