HTML::HTML5::Entities(3pm) | User Contributed Perl Documentation | HTML::HTML5::Entities(3pm) |
HTML::HTML5::Entities - drop-in replacement for HTML::Entities
use HTML::Entities; my $enc = encode_entities('fish & chips'); print "$enc\n"; # fish & chips my $dec = decode_entities($enc); print "$dec\n"; # fish & chips
This is a drop-in replacement for HTML::Entities, providing the character entities defined in HTML5. Some caveats:
If called in void context the arguments are decoded in-place.
This routine is exported by default.
If $expand_prefix is TRUE then entities without trailing ";" in %entity2char will even be expanded as a prefix of a longer unrecognized name.
$string = "foo bar"; _decode_entities($string, { nb => "@", nbsp => "\xA0" }, 1); print $string; # will print "foo bar"
This routine is exported by default.
If called in void context the string is encoded in-place.
This routine is exported by default.
This routine is not exported by default.
This routine is not exported by default.
The following functions cannot be exported. They behave the same as the exportable functions.
It only affects the encoding functions. Decoding always understands both notations.
Note that %char2entity is a more conservative set of mappings, intended to be safe for serialising strings to HTML4, HTML5 and XHTML 1.x. And for hysterical raisins, %entity2char does not include the leading ampersands, while %char2entity does.
Please report any bugs to <http://rt.cpan.org/Dist/Display.html?Queue=HTML-HTML5-Entities>.
HTML::Entities, HTML::HTML5::Parser, HTML::HTML5::Writer.
Toby Inkster <tobyink@cpan.org>.
Copyright (c) 1995-2006 by Gisle Aas.
Copyright (c) 2012 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Copyright (c) 2004-2007 by Apple Computer Inc, Mozilla Foundation, and Opera Software ASA.
Copyright (c) 2007-2011 by Wakaba <w@suika.fam.cx>.
Copyright (c) 2009-2012 by Toby Inkster <tobyink@cpan.org>.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2022-10-13 | perl v5.34.0 |