Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^4: replace &

by Corion (Patriarch)
on Jun 04, 2009 at 07:46 UTC ( #768331=note: print w/replies, xml ) Need Help??


in reply to Re^3: replace &
in thread replace &

If a string and the HTML::Entities-decoded result of the string are the same, it is no HTML entity.

Replies are listed 'Best First'.
Re^5: replace &
by sandy1028 (Sexton) on Jun 04, 2009 at 08:04 UTC
    #!/usr/bin/perl; use HTML::Entities; $to_decode = "TEST&TEST;A&E&an HTML--- string - <© T +VS>"; $encoded = encode_entities($to_decode); print "Encoded data --> $encoded\n\n\n";
    The output is Encoded data --> TEST&TEST;A&E&an HTML--- string - <© TVS> Here all the & is replaced with &. If it is a HTML entity it should not encode the string for ex:   Here it displays as   it should be   only

      I don't understand what your reply has to do with the original question of finding out whether a string is an HTML entity and my reply on how to detect whether a string is an HTML entity.

        For example : If the string contain $a= &foo foo When I encode it using the function encode_entities($a); The   should not be encoded. So the final output after encoding should be &foo foo Now the output is &foo foo. So I wanted to check it the string is HTML entity?
          A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2023-12-02 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (16 votes). Check out past polls.

    Notices?