Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Help with HTML::Entities - decode_entities

by punch_card_don (Curate)
on Jul 09, 2010 at 00:27 UTC ( #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.


Comment on Re: Help with HTML::Entities - decode_entities
Select or Download Code
Re^2: Help with HTML::Entities - decode_entities
by ikegami (Pope) 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
Node Status?
node history
Node Type: note [id://848792]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2014-10-22 03:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (112 votes), past polls