linux curl save as utf-8

后端 未结 2 662
栀梦
栀梦 2021-01-04 06:18

Trying to use linux curl to download an xml file from an url.

Pretty sure that the xml is encoded in UTF-8,

suspecting curl -o doesnt save as UTF-8.

2条回答
  •  礼貌的吻别
    2021-01-04 06:52

    Have you tried adding the Accept-Charset header? I had a similar issue downloading a file which was downloading with the wrong encoding. When I set the Accept-Charset header it works:

    curl -H "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" URL | iconv -f iso8859-1 -t utf-8 > output.xml
    

提交回复
热议问题