我有前进1 UTF-8字符和返回的字节数花了到那里的函数:函数返回1个UTF-8字符?
// Moves the iterator to next unicode character in the string,
//returns number of bytes skipped
template<typename _Iterator1, typename _Iterator2>
inline size_t bringToNextUnichar(_Iterator1& it,
const _Iterator2& last) const {
if(it == last) return 0;
unsigned char c;
size_t res = 1;
for(++it; last != it; ++it, ++res) {
c = *it;
if(!(c&0x80) || ((c&0xC0) == 0xC0)) break;
}
return res;
}
我怎么能修改,这样我可以从任意回去Unicode字符字符?
谢谢
Utf8可能需要超过1个字符。 – 2011-02-11 01:33:30