This looks suspiciously like IsUTF8(), just with 3 return codes instead of 2.