utf.hpp
utf.hpp copied to clipboard
potential bug in utf8 encode
If size_t len = write_length(c); returns 0 then the next loop will cause a serious issue:
for (size_t i = len; i != 1; --i) { // select lower 6 bits res[i-1] = (c & 0x3f) | 0x80; c = c >> 6; }