I assume that you also inserted a NUL byte into your somefile.txt to make grep treat it as binary.
cURL behaves predictably now as well as before. It will warn you if you try to print unprintable data to your terminal, but can be told to ignore it, and won't affect output redirects.
I often end up doing things like: watch --color juju status --color or "ls -c | less -r", etc.
Which could mess up your terminal, so curl is doing the right thing.
> UTF-Encoding
On Unix, terminals would be completely broken if they used UTF-16. Other Unicode Transmission Formats don't use null bytes.
> special use cases
Such as?
> In fact, I run into this problem with grep from time to time and it is super annoying:
That's not applicable here, because grep only prints parts of the file, while curl prints out the whole file.
Changing behavior of something that is as popular as curl to protect edge cases is strange, to say the least.
Which was the right change. It prevents data loss for negligible added complexity.
It will make curl fail if a 0 byte is outputted within the text. There are many reasons why this will happen. Software errors, UTF-Encoding, special use cases...
In fact, I run into this problem with grep from time to time and it is super annoying:
So this change makes the code base more complex and the behavior fuzzy.I prefer elegant software that behaves predictably.