Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Help with HTML::Entities - decode_entities

by punch_card_don (Curate)
on Jul 09, 2010 at 00:27 UTC ( [id://848792]=note: print w/replies, xml ) Need Help??


in reply to Help with HTML::Entities - decode_entities

For example, this test code:
#!/usr/bin/perl use strict; use warnings; use HTML::Entities; print "Content-type: text/html\n\n"; my $str = "Fred&#39;s shoe"; _decode_entities($str, { amp => "&", 59 => ";" }, 0); print "<p>$str\n";
Outputs
<p>Fred's shoe
even though the docs say

_decode_entities( $string, \%entity2char, $expand_prefix )
This will in-place replace HTML entities in $string. The %entity2char hash must be provided. Named entities not found in the %entity2char hash are left alone.




Time flies like an arrow. Fruit flies like a banana.

Replies are listed 'Best First'.
Re^2: Help with HTML::Entities - decode_entities
by ikegami (Patriarch) on Jul 09, 2010 at 00:29 UTC
    "&#39;" is not a named entity. It's numerical.
      *!*! SMACK !*!* You could have had a V8!

      Ok, so you can't do this with this module. Back to the regex's.

      thanks.




      Time flies like an arrow. Fruit flies like a banana.
Re^2: Help with HTML::Entities - decode_entities
by Anonymous Monk on Jul 09, 2010 at 00:33 UTC
    Named entities not found in the %entity2char hash are left alone. Numeric entities are expanded unless their value overflow.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-16 19:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found