[Gtk-sharp-list] TextView and UTF8

Iñigo Illán iillan@terra.es
20 Sep 2003 12:02:53 +0200


I'm not sure if this is going to solve your problem, but try to use
System.Environment.NewLine instead the '\n' hardcoded char.

Example:

ChatBuf.Text += System.Environment.NewLine + "[ip]: " + strReceived;


El sáb, 20 de 09 de 2003 a las 10:58, Yves Ineichen escribió:
> hi all,
> 
> i want to add some received data to a TextView
> 
> Byte[] received = new Byte[256];
> //...
> String strReceived = System.Text.Encoding.UTF8.GetString(received);
> ChatBuf.Text += "\n[ip]: " + strReceived;
> 
> asserts:
> (<unknown>:1956): Gtk-CRITICAL **: file gtktextbuffer.c: line 543
> (gtk_text_buffer_emit_insert): assertion `g_utf8_validate (text, len,
> NULL)'
> failed
> 
> same with:
> UTF8Encoding u8 = new UTF8Encoding();
> ChatBuf.Text += "\n[ip]: " + u8.GetString(received);
> 
> why the assertion? the string should be utf8 encoded - or where is the
> mistake?