in reply to utf8 char or binary string detection

Even if the string is only a stream of random bytes, and especially of the string is short, it may sometimes happen that those bytes turn out to be a valid utf8 string (probably meaningless in your context, but still technically valid). It is presumably too late to know at this point.

Maybe you should say more about the general process, to figure out if something can be done upstream.

  • Comment on Re: utf8 char or binary string detection