> Me: > I will look at the fl_utf8fwd() and fl_utf8back() function tonight, > if I have time, to see how they handle the following byte sequences: > > a a a^123 X a a > a a a 123 X^a a > a a X X^X X a a > > where 'a' is an ascii byte (0x01-0x7f), 'X' is a CP1252 byte (0x8-0x9f) > and '1' is a utf-8 header byte and '2' and '3' are utf-8 trailer bytes, > and '^' represents the current index pointing to the byte on the right.
It's a little counter-intuitive to start with, because the pointer returned by fl_utf8fwd() and fl_utf8back() is only moved it pointed into the trailing bytes of a utf-8 sequence. What you need to do is: p++ ; p = fl_utf8fwd(p, ...); // to move p to next character p-- ; p = fl_utf8back(p, ...); // to move p to prev character As far as I can tell, both fl_utf8fwd() and fl_utf8back() handle the CP1252 0x80-0x9f bytes in the example sequences proposed above. See the utf8_fwbk_test.cxx code under http://www.fltk.org/str.php?L2348 Cheers D. _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
