ITeye博客

curl 下载 字符集转化

wushexin · 2011-04-21 10:02 · linux shell · 操作系统 · Markdown

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>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。