While working on a project recently, I came across an odd warning upon running
foouser@foo:~$ curl "https://api.foo.example/blah"
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
The thing is though, I wasn't expecting to retrieve a binary file; it should have been a standard json response. Indeed, even when I checked the address in my web browser, I got the normal text output. So... what the heck?
As it turns out, the data was compressed.
Solution: run the
curl command with the
--compressed switch. Voila! Solved.
Huge thanks to StackExchange user Stephen Kit and his response here