curl command output has wrong encoding curl command output has wrong encoding curl curl

curl command output has wrong encoding


curl will automatically decompress the response if you set the --compressed flag:

curl --compressed "http://example.com"

--compressed (HTTP) Request a compressed response using one of the algorithms libcurl supports, and save the uncompressed document. If this option is used and the server sends an unsupported encoding, curl will report an error.

refrence of answer

if you need use this option only for gzip content encoding, use this command

curl -sH 'Accept-encoding: gzip' http://example.com/ | gunzip -


I think is connected with default encoding of your terminal (which default is UTF-8). You can try to pass the stream to the file, for instance:

curl "http://weather.yahooapis.com/forecastrss?w=1225955&u=c" > response

I had the same problem with rest webservice, when I was passing bytes (Pdf content format inside Data Handler). Without passing stream I was receiving data encoded in UTF-8 in terminal and also when I was using soapUi.


Try setting the charset of the terminal to utf-8. A google got me this:https://unix.stackexchange.com/questions/28136/set-gnome-terminals-default-charset-to-utf8

Before you set the encoding check to make sure that indeed is the issue by determining the current charset as in:

How to get terminal's Character Encoding