lingaraj has asked for the wisdom of the Perl Monks concerning the following question:
print in terminal it's printing fine... writing file give some illegal char...sub http_fetch { my $tmp_file = $_[0]; my ( $http_fetch_file ) = $_[1]; my @tmp_content = (); #----------------------------------------------------------------- +-----------------------------------------------HTTP Fetch require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(80); #$ua->show_progress(1); #$ua->agent('Mozilla/4.0 (compatible; MSIE 5.0; Windows 95)'); #$ua->proxy(["http"], "http://proxy.msat:80"); #$ua->env_proxy; eval { my $response_hash = $ua->get($tmp_file); open(HTMLFH,">$http_fetch_file"); print HTMLFH $response_hash->content; close(HTMLFH); }; if ($@) { print "HTTP Error\n"; } #----------------------------------------------------------------- +----------------------------------Load Content Into Array else { open(HTMLFH, $http_fetch_file); @tmp_content = <HTMLFH>; close(HTMLFH); } return @tmp_content; } .... ... ... ... ... .... .... open XMLFH ,">:utf8","$record{Curr_XML_File}"; print XMLFH $final_content; close XMLFH;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: utf8 writing
by Eliya (Vicar) on Feb 20, 2011 at 22:21 UTC | |
Re: utf8 writing
by GrandFather (Saint) on Feb 20, 2011 at 19:38 UTC | |
Re: utf8 writing
by ikegami (Patriarch) on Feb 20, 2011 at 20:44 UTC | |
Re: utf8 writing
by Monkomatic (Sexton) on Feb 21, 2011 at 00:58 UTC |
Back to
Seekers of Perl Wisdom