This should work (untested):
int findFirstNCharacters(const char *str, int n)
{
int bytes = 0;
int maxBytes = strlen(str);
while (n>0 != *str!=0) {
int bytesInChar = fl_utf_nb_char(*str, maxBytes);
if (bytesInChar==-1) break; // error in UTF-8
bytes += bytesInChar;
maxBytes -= bytesInChar;
str += bytesInChar;
n--;
}
return bytes;
}_______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
