[Gtk-sharp-list] TextView and UTF8

Yves Ineichen yves.ineichen@dplanet.ch
20 Sep 2003 10:58:30 +0200


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?

-- 
Yves Ineichen