2 ms·
The test suite includes these as "bad" sequences: * \xc0\x9f (overlong U+001F) * \xed\xa0\x81 (surrogate)
by jwilk 8y ago
The test suite includes these as "bad" sequences:
* \xc0\x9f (overlong U+001F)
* \xed\xa0\x81 (surrogate)
- SloopJon 8y agoI was too lazy to look up what these sequences represented, but I did a quick test with the Euro symbol example from Wikipedia, and it did indeed reject the overlong sequence: #include <stdbool.h> #include <string.h> #include <stdio.h> #include "simdutf8check.h" int main(int argc, char *argv[]) { const char euro[] = "\xe2\x82\xac"; const char eurolong[] = "\xf0\x82\x82\xac"; bool valid = validate_utf8_fast(euro, sizeof euro); printf("validate_utf8_fast(euro): %d\n", valid); valid = validate_utf8_fast(eurolong, sizeof eurolong); printf("validate_utf8_fast(eurolong): %d\n", valid); return 0; }