Re: LWP ends up with unreadable characters

Gisle Aas <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
[email protected] writes:

> i'm trying to use LWP on:
> 
> 	http://education.yahoo.com/reference/dict_en_es/spanish/a_1;_ylt=
> 	AoFfUtrOQo3d1vl10ohvPPb2s8sF
> 
> when i do :
> 
>        $ua = LWP::UserAgent->new;
>        $res1 = $ua->get($url,%header);
>        my $page = $res1->content;
> 
> '$page' ends up with unreadable characters. the code works fine for
> most sites. also, if i fetch the page with 'lynx' i get readable stuff,
> and a browser's 'view source' function on the page gets a normal
> result.  
> 
> ideas?

Try to provide a complete program that we can run to reproduce your
problem.  I certainly get text out when I try to access your URL with
this program:

#!/usr/bin/perl -w

use strict;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new;
my $res = $ua->get('http://education.yahoo.com/reference/dict_en_es/spanish/a_1;_ylt=AoFfUtrOQo3d1vl10ohvPPb2s8sF');
my $page = $res->content;

print $page;
__END__

Perhaps you have something interesting in %header that you don't tell us about?

Regards,
Gisle
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.