in reply to utf8 char or binary string detection

don't rely on the utf8 flag in any case. It doesn't do what you think it does.

Other than that,it don't understand what you mean 'if the string is bytes'. It's always bytes, it's the encoding that morphs it (into utf8 or otherwise)

I think you meant 'I want to know when it is or is not utf8'.
You can't know becuase utf does not have a signature to denote that what follows is utf,except when the BOM is used, which is rarely
  • Comment on Re: utf8 char or binary string detection