Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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;
print in terminal it's printing fine... writing file give some illegal char...

In reply to utf8 writing by lingaraj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-16 21:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found