Re: GtkTextBuffer: Q: offsets to indicies?



On Thu, 2002-08-01 at 18:28, Gustavo Carneiro wrote:
  This is what you want:

gtk_text_buffer_get_iter_at_offset(GtkTextBuffer *buffer,
                                   GtkTextIter *iter,
                                   gint char_offset);


No, this is what I am using now. I do not have the char_offset - I have
the byte index. The text below (from the GTK+ API ref.) explains it:

"One of the important things to remember about text in GTK+ is that it's
in the UTF-8 encoding. This means that one character can be encoded as
multiple bytes. Character counts are usually referred to as offsets,
while byte counts are called indexes. If you confuse these two, things
will work fine with ASCII, but as soon as your buffer contains multibyte
characters, bad things will happen."

Regards,
Janus N. Tøndering




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