[stef...@apache.org] > + for (; len > 0; ++data, --len) > + if (*data < 0) > + return data;
Two major problems: 1) It doesn't account for character sets like Shift-JIS, where state change is signalled by ASCII 14 and 15 ("shift out", "shift in") 2) It assumes a 'char' is signed by default. This is not true on all platforms. Better to test if (*data < 32 || *data > 127), even though that has false positives with characters like \t and \n. Peter