Quoth Mouse:
- flag = !StrNCmp(t, "utf-8", 5);
+ flag = !strncasecomp(t, "utf-8", 5);
I haven't read the full context here, so I could be a bit off-base,
but, surely using strncasecmp (or strncasecomp, whatever that is) is a
bit dodgy here? You don't want "utf-8-is-stupid" to be taken as
"utf-8", surely? (Not that I've ever seen the former in the wild, and
I haven't actually read the spec myself, but I doubt it considers all
strings beginning with UTF-8 to be equivalent to UTF-8.)
You are entirely correct. This is one hacky parser. It does consider
anything prefixed with utf-8 to be equivalent to utf-8 and that
absolutely is bad behavior. By all means, send patches if you will.