I'm trying to use Perl and WWW::Mechanize to login to webmail and download an attachemt (CSV file).
The script is able to get the file but the problem is, I'm getting garbled characters on the CSV file. This does not happen if I download the CSV file using a browser.
Here is the code that I am using:
$mech = WWW::Mechanize->new();
$cook = $zangomech->cookie_jar(HTTP::Cookies-
w(file => "cookies.txt", autosave => 1,));
me' => 'username');
$mech->field('secretkey' => 'pass');
-Type' => 'text/plain', 'charset' => 'utf-8');
$mech->follow_link( text => "emaillink", n => 1);
$mech->follow_link( text => "Download", n => 2);
$output = $mech->content();
print OUTFILE "$output";
Below is what I see when I open up the CSV file, i just changed the filename ext from .csv to .txt so it could be loaded on a browser.:
- - - - - -
I'm really not sure what these are so I couldn't d any cleanup programatically.
Thanks in advance.