Hello,

I have a question in regarding use of the Fl_Input::insert() method
in combination with UTF-8 strings.

If I want to insert a text after the second UTF-8 character, it
would seem natural to use:

---- snip ----
#include <FL/Fl_Input.H>
#include <stdio.h>
int main()
{
  Fl_Input t(0,0,0,0);
  t.value( "ДБИЯ" );
  t.position( 2 );
  printf( "t.value(): '%s' size=%d\n", t.value(), t.size());
  t.insert( "Ж" );
  printf( "t.value(): '%s' size=%d\n", t.value(), t.size());
  printf( "t.position(): %d\n", t.position());
}
---- snip ----

But it looks like position(2) sets the position to the byte-offset 2
and not after the second *UTF-8 character*, as the outcome is:

---- snip ----
t.value(): 'ДБИЯ' size=8
t.position(): 2
t.value(): 'ДЖБИЯ' size=10
t.position(): 4
---- snip ----


How is it supposed to be done and is this the desired behaviour?

chris

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to