Re: [pygtk] TextBuffer and g_utf8_validate
In Python the insert method doesn't need the length argument - it is optional. If omitted it will use the length of the string passed in automatically. Cheers, Matt On Mon, Mar 04, 2002 at 03:19:30PM +0100, Pier Carteri wrote: > I'm sorry, probably I must count to 10 before sending a mail to the > list, because the solution was in front of me :-P > Reading the c doc of gtk2 I've notice that if I use > > self.buffer.insert(start,text,-1) > > the string must be Null terminated; so I've changed that line with > > self.buffer.insert(start,text,len(text)) > > and everythings works! > Sorry again for the spam ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] TextBuffer and g_utf8_validate
I'm sorry, probably I must count to 10 before sending a mail to the list, because the solution was in front of me :-P Reading the c doc of gtk2 I've notice that if I use self.buffer.insert(start,text,-1) the string must be Null terminated; so I've changed that line with self.buffer.insert(start,text,len(text)) and everythings works! Sorry again for the spam Pier Il lun, 2002-03-04 alle 15:00, Pier Carteri ha scritto: > Hi again, > Thanks Matt, can you tell me how to check if a file contains such > chars, and in that case how to convert in a format that can be displaied > on gtkTextView? (my files are usually python modules or script) > > Pier > > Il lun, 2002-03-04 alle 14:52, Matt Wilson ha scritto: > > On Mon, Mar 04, 2002 at 02:50:57PM +0100, Pier Carteri wrote: > > > > > > editor(pid:1549): Gtk-CRITICAL **: file gtktextbuffer.c line 476 > > > (gtk_text_buffer_emit_insert): assertion 'g_utf8_validate (text, len, > > > NULL)' failed > > > > > > The files are normal text file; where is the error? > > > > They must have some high ASCII chars in there. > > > > Cheers, > > > > Matt > > ___ > > pygtk mailing list [EMAIL PROTECTED] > > http://www.daa.com.au/mailman/listinfo/pygtk > > > ___ > pygtk mailing list [EMAIL PROTECTED] > http://www.daa.com.au/mailman/listinfo/pygtk ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] TextBuffer and g_utf8_validate
Hi again, Thanks Matt, can you tell me how to check if a file contains such chars, and in that case how to convert in a format that can be displaied on gtkTextView? (my files are usually python modules or script) Pier Il lun, 2002-03-04 alle 14:52, Matt Wilson ha scritto: > On Mon, Mar 04, 2002 at 02:50:57PM +0100, Pier Carteri wrote: > > > > editor(pid:1549): Gtk-CRITICAL **: file gtktextbuffer.c line 476 > > (gtk_text_buffer_emit_insert): assertion 'g_utf8_validate (text, len, > > NULL)' failed > > > > The files are normal text file; where is the error? > > They must have some high ASCII chars in there. > > Cheers, > > Matt > ___ > pygtk mailing list [EMAIL PROTECTED] > http://www.daa.com.au/mailman/listinfo/pygtk ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] TextBuffer and g_utf8_validate
On Mon, Mar 04, 2002 at 02:50:57PM +0100, Pier Carteri wrote: > > editor(pid:1549): Gtk-CRITICAL **: file gtktextbuffer.c line 476 > (gtk_text_buffer_emit_insert): assertion 'g_utf8_validate (text, len, > NULL)' failed > > The files are normal text file; where is the error? They must have some high ASCII chars in there. Cheers, Matt ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] TextBuffer and g_utf8_validate
Hi, as said in my previous post (I hope not boring you ) I'm working on a code editor based on GtkTextBuffer and GtkTextView; the method for load a file is something like this: try: file=open(self.name,'r') text=file.read() start=self.buffer.get_start_iter() self.buffer.insert(start,text,-1) self.set_save_point() except: do somethings Usually everythings works as supposed but sometimes I have the following error: editor(pid:1549): Gtk-CRITICAL **: file gtktextbuffer.c line 476 (gtk_text_buffer_emit_insert): assertion 'g_utf8_validate (text, len, NULL)' failed The files are normal text file; where is the error? (gtk2 1.3.14 python2.2 pygtk 1.99.7) Thank you! Pier ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk