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

Re: Perl not printing any special characters in array

by hippo (Bishop)
on Jun 22, 2014 at 15:03 UTC ( [id://1090836]=note: print w/replies, xml ) Need Help??


in reply to Perl not printing any special characters in array

All special characters are replaced by some junk values. for example (€)euro is printed as (-aA).

This suggests that you have forgotten to decode your input or to encode your output or both. Have you read perlunitut and perlunifaq?

  • Comment on Re: Perl not printing any special characters in array

Replies are listed 'Best First'.
Re^2: Perl not printing any special characters in array
by myfrndjk (Sexton) on Jun 22, 2014 at 18:56 UTC
    Hi, Thanks for your suggestion,but i don't know where to add those in my code.I tried but still no change in result.can you tell me where to add those encode/decode in my code. Thanks

      Useless reply, myfrndjk; show us the code you "tried" (presumably, 'added') and tell us, in detail, how it failed.

      .

      Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
      1. code
      2. verbatim error and/or warning messages
      3. a coherent explanation of what "doesn't work actually means.

      check Ln42!

        Hi sorry for that reply.I tried "use Encode" and tried to encode "@node". I cant understand these encoding stuffs.After doing this i didnt get any error or warning my logics are working fine but it is not printing special chars example:GRATUITA per gli ordini superiori a €85!

        while(<FILE>) { chomp; $url=$_; foreach ($url) { ($domain) = $url =~ m|www.([A-Z a-z 0-9]+.{3}).|x; } do 'C:/Users/jk/Desktop/perl/mainsub.pl'; &domain_check(); my $ua = LWP::UserAgent->new(agent => "Mozilla/5.0"); my $req = HTTP::Request->new(GET => "$url"); my $res = $ua->request($req); die("error") unless $res->is_success; open my $xp, '>:encoding(UTF-8)', $res; my $xp = HTML::TreeBuilder::XPath->new_from_content($res->content) +; my @node = $xp->findnodes_as_strings(decode('UTF-8',("$xpath"))); $nodedeath="node doesn't exist"; die($nodedeath) if $#node == -1; open HTML, ">C:/Users/jk/Desktop/shippperl/$com.html"; foreach(<@node>) { $death=$_; '>:encoding(UTF-8)', $death; print HTML "$death\n"; } } do 'C:/Users/jk/Desktop/perl/openafilenew.pl'; compare_result(); }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1090836]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-18 09:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found