IsUTF8 will return 'true' for cases where this code return 'plainAscii'.
Current code is not really working correct, it's broken by design. It was taken from RFC that was never accepted,
Current code lacks any explanation for mask for second byte. And with current UTF-8 specification it's not possible to check second byte only by mask.
In new code everything is documented, everything is followed current standard (link in code).
We need 3 return codes. For RegExp I will check for `== utf8string`, for charset conversion I will check for `!= hiAscii`, because plainAscii is valid UTF-8.
I can't fix current code, I can only replace it with new one.