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