a pure ascii string (0x00-0x7F) is also a valid UTF-8 string, so it should detect both of them, if not with a 100% confidence maybe a 99% for the UTF-8 case to give priority to the ascii one
if text has emojis or any code sequence outside of the ones of pure ascii, definitely it's NOT a pure ascii string
I think here there are two bugs: