4 ms·
I 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 ove
by SloopJon 8y ago
I 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;
}