Re: Coding systems ?



Hi Olivier,

On 1/22/07, Olivier Ramare <Olivier Ramare univ-lille1 fr> wrote:
  -- The file I read has nothing other than ascii
characters (letters even from a-zA-Z and punctuation).
  -- But gtk complains with enumerables
---------------------------------------------------------------------------------
Gtk-CRITICAL **: gtk_text_buffer_emit_insert:
assertion `g_utf8_validate (text, len, NULL)' failed
--------------------------------------------------------------------------------

I think you must have a non-ASCII character in there somewhere. I do
(almost) this without problems. Perhaps your read routine is pasting
the EOF (-1) character into the string by mistake?

How about testing your characters before you insert them? Plain ASCII
is in the range 0 to 0x7f, so try:

for (i = 0; i < len; i++)
 if ((unsigned char) text[i] > 0x7f)
   printf ("non-ASCII at index %d\n", i);
gtk_text_buffer_set_text (buffer, text, len);

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]