tiny-utf8 icon indicating copy to clipboard operation
tiny-utf8 copied to clipboard

Incorrect string size of the constructor of tiny-utf8(not only use LITLEN)

Open lencil opened this issue 2 years ago • 0 comments

I've tested these cases (windows 11, msvc 2022 with ninja):

tiny_utf8::string utf8str(u8"q🌍");
utf8str.length() is 2.

but if you do this:

tiny_utf8::string utf8str(u8"q🌍\0\0");
utf8str.length() is 4.( This should be 2)

and if the c str is not a literal string but in memory string the length of the utf8str is not always equal to strlen(cstr);

so I have to do like this:

const char *str = u8"q🌍\0\0";
tiny_utf8::string utf8str(str, strlen(str));
utf8str.length() is 2.

lencil avatar Jan 04 '24 09:01 lencil