Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Converting HTML Entities to thier numeric equivalent

by Wonko the sane (Deacon)
on Dec 09, 2004 at 20:29 UTC ( [id://413676]=perlquestion: print w/replies, xml ) Need Help??

Wonko the sane has asked for the wisdom of the Perl Monks concerning the following question:

I am looking for an easy way to convert HTML entities, like
´   &
into thier numeric representations.

So.
& would be converted to &
¡ would be converted to ¡

and so on.

I need this to work for ALL of the HTML entities. I am trying to get out of writting
a search and replace regex for all 255 of the different HTML entities like this. :)

I find it hard to believe that there is not a module already out ther that can do this for me.

Any help or pointer on solving this problem would be much appreciated.

Best Regards,
Wonko

Replies are listed 'Best First'.
Re: Converting HTML Entities to thier numeric equivalent
by Ovid (Cardinal) on Dec 09, 2004 at 20:48 UTC
      Perfect! Thank you very much. Just what I needed.

      Best Regards,
      Wonko

Re: Converting HTML Entities to their numeric equivalent
by Roy Johnson (Monsignor) on Dec 09, 2004 at 20:35 UTC
    Browsing the source of HTML::Encoder, I find a table that provides the reverse mapping of what you're looking for -- sort of. It could be helpful.

    Update: Hold the phone! I found it: HTML::Entities::Numbered provides conversions between numbered and named entities.


    Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

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

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

    No recent polls found