GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Mojo::DOM58::Entities(3) User Contributed Perl Documentation Mojo::DOM58::Entities(3)

Mojo::DOM58::Entities - Escape or unescape HTML entities in strings

  use Mojo::DOM58::Entities qw(html_escape html_unescape);
  
  my $str = 'foo & bar';
  $str = html_unescape $str; # "foo & bar"
  $str = html_escape $str; # "foo & bar"

Mojo::DOM58::Entities contains functions for escaping and unescaping HTML entities for Mojo::DOM58, based on functions from Mojo::Util. All functions are exported on demand.

  my $str = html_attr_unescape $escaped;

Same as "html_unescape", but handles special rules from the HTML Living Standard <https://html.spec.whatwg.org> for HTML attributes.

  # "foo=bar&ltest=baz"
  html_attr_unescape 'foo=bar&ltest=baz';
  # "foo=bar<est=baz"
  html_attr_unescape 'foo=bar&lt;est=baz';

 my $escaped = html_escape $str;

Escape unsafe characters "&", "<", ">", """, and "'" in string.

 html_escape '<div>'; # "&lt;div&gt;"

 my $str = html_unescape $escaped;

Unescape all HTML entities in string, according to the HTML Living Standard <https://html.spec.whatwg.org/#named-character-references-table>.

 html_unescape '&lt;div&gt'; # "<div>"

Report issues related to the format of this distribution or Perl 5.8 support to the public bugtracker. Any other issues should be reported directly to the upstream Mojolicious issue tracker.

Dan Book <dbook@cpan.org>

Code and tests adapted from Mojo::Util, a set of utilities by the Mojolicious team.

Copyright (c) 2008-2016 Sebastian Riedel and others.

Copyright (c) 2016 Dan Book for adaptation to standalone format.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

HTML::Entities

2025-05-19 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.