On Sun, 2009-01-11 at 22:57 -0800, 日总结 wrote: > > On 1月12日, 下午2时46分, 日总结 <[email protected]> wrote: > > 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; > > print $content; #查看连接到的网页 > > > > 我得到的网页是乱码,请问 我应该怎么办 ? 试试这个 use HTML::Entities; encode_entities($content, "\200-\377"); 也可转utf-8 $content = encode('utf8',$content); > 我试了 我用的DZsoft perl Editor 点击运行 文本显示乱码 > 我创建文本文件jp.txt后 > 把抓取的网页发到jp.txt后,看到的就没有乱码了! > 应该是DZsoft perl Editor的问题吧 > > open(GP,">jp.txt"); > printf GP $content; > >
--~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“PerlChina 论坛”论坛。 要在此论坛发帖,请发电子邮件到 [email protected] 要退订此论坛,请发邮件至 [email protected] 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛 -~----------~----~----~----~------~----~------~--~---
