2 ms·
I gave it a whirl and it correctly rejects examples of each 'invalid byte sequence' cited by wikipedia. "\xff", // invalid byte "\x82", // unexpected c
by jepler 8y ago
I gave it a whirl and it correctly rejects examples of each 'invalid byte sequence' cited by wikipedia.
"\xff", // invalid byte
"\x82", // unexpected continuation byte
"\xc0", // not enough continuation bytes
"\xed\xa0", // not enough continuation bytes
"\xc0\x80", // "modified UTF-8's not really NUL (over-long encoding)
"\xf0\x82\x82\x8c", // over-long euro symbol
"\xed\xa0\x80", // invalid surrogate character U+d800