Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^3: Convert HTML symbols to equivalent Unicode

by dorward (Curate)
on Apr 15, 2009 at 10:01 UTC ( #757613=note: print w/replies, xml ) Need Help??

in reply to Re^2: Convert HTML symbols to equivalent Unicode
in thread Convert HTML symbols to equivalent Unicode

I spider some web pages and pull some information from them.

At this point you will either have the results of parsing HTML or you will have raw HTML.

when is passed to it, it is converted to ®

This suggests you are dealing with parsed HTML, with any entities already converted to real characters.

In this case, there are two approaches you could take.

  1. Use a module designed for writing XML
  2. Use a generic template module

If you use a module designed for writing XML then you can just pass the and the module will output either a raw or a numeric entity for it. Any XML parser that this XML gets read by should be able to cope with either, so it doesn't matter which you end up with and you don't need to worry about it.

If you use a generic templating language, then you have to deal with using a raw or converting it with HTML::Entities::encode_numeric() or a similar module. Basically — you have to do all the things that a proper XML module would do for you.

It sounds like you are using a generic templating language, but it is almost certainly better to use a real XML module.

Afterthought: You might also be messing about with raw strings in the middle of your code. That way lies madness.

  • Comment on Re^3: Convert HTML symbols to equivalent Unicode

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://757613]
[Corion]: But LPW was enjoyable, even though it's always a bit hectic due to cramming everything into one day
[Corion]: I have no feeling about how my talk was received, but I'm happy with it, which counts the most to me ;-D
[Corion]: Also, London is always a nice visit, as I got to meet a friend there, and spent some time offline, working on "minor" features of the shadertoy thing ;)
[marto]: maybe next year when the kids are a little older I'll have time to attend perl events in Europe
[Corion]: marto: Yeah - there isn't a Perl Day-Care at Perl events - we thought about it for YAPC::Europe 2012 but it's a gigantic effort to organize that

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2016-12-07 09:29 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (125 votes). Check out past polls.