News for hackers. Stuff that matters.
Re:Curl doesn’t spew binary anymore by asdfaoeu on Saturday June 17, 2017 @08:00AM (#14575505)
> what if your output is a normal UTF-8 string but contains a byte 0?

It's not really a valid character to print to a terminal and most terminals ignore it nor is it particular valid in a "text file".

As for the rest of your questions if the bytes in the file are randomly distributed which is common with compressed binary files the chance that there is not a zero byte in the first 2000 bytes is 0.03% which seems low enough.

Re:Curl doesn’t spew binary anymore by baby on Saturday June 17, 2017 @08:08AM (#14575537)
> if the bytes in the file are randomly distributed

This is rarely true I believe, but binary files should often use the 0 byte because it sounds "practical" to use (going with the instinct here). So I'm guessing this test is "good enough"