`

curl 下载 字符集转化

阅读更多

 

shell 写道
curl 下载页面时,时常会乱码,可以用:iconv -f gbk -t utf-8 来转码;示例:

[oracle@localhost ~]$ curl http://www.ip138.com/ip2city.asp | grep body

<body style="margin:0px"><center>?μ?Pμ?·?£o[114.249.221.61] </center></body></html>

[oracle@localhost ~]$ curl http://www.ip138.com/ip2city.asp | grep body | iconv -f gbk -t utf-8

<body style="margin:0px"><center>您的IP地址是:[114.249.221.61] </center></body></html>
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics