2009年1月19日星期一

[PerlChina] Re: LWP 乱码怎么解决?

use strict;
my $url = 'http://www.gotojp.net/schools_detail46.htm';

use LWP::Simple;
my $content = get $url;
 die "Couldn't get $url" unless defined $content;

my $gbk_cont=encode('gbk', decode('utf8',$content->content));
print $gbk_cont;

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina 论坛"论坛。
 要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
 要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛

-~----------~----~----~----~------~----~------~--~---

没有评论: