Curl doesn’t spew binary anymore
I just looked at the commit and I was surprised at how nice the code is! The relevant line to my question is:<p><pre><code>  if(isatty && (outs->bytes < 2000) && terminal_binary_ok) {
    if(memchr(buffer, 0, bytes)) {
</code></pre>
memchr() returns the first occurrence of the byte 0 (your second argument), or NULL.<p>So a few things:<p>* what if your output is more than 2000 bytes?<p>* what if your output is binary but doesn’t contain a byte 0?<p>* what if your output is a normal UTF-8 string but contains a byte 0? ( see <a href="https://stackoverflow.com/questions/6907297/can-utf-8-contain-zero-byte" rel="nofollow">https://stackoverflow.com/questions/6907297/can-utf-8-contai...</a> )<p>This is interesting to me as I am developing a tool that parses files in search for bugs and I need to ignore binary files. What I am doing right now: when checking a line, if it is not a valid UTF-8 string I skip the file. It's not really nice as I am doing this verification for every file's lines...