NAME

DOM::Tiny::Entities - Escape or unescape HTML entities in strings

SYNOPSIS

use DOM::Tiny::Entities qw(html_escape html_unescape);

my $str = 'foo & bar';
$str = html_unescape $str; # "foo & bar"
$str = html_escape $str; # "foo & bar"

DESCRIPTION

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

FUNCTIONS

html_escape

my $escaped = html_escape $str;

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

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

html_unescape

my $str = html_unescape $escaped;

Unescape all HTML entities in string, according to the HTML Living Standard.

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

BUGS

Report any issues on the public bugtracker.

AUTHOR

Dan Book <dbook@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Dan Book.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

SEE ALSO

HTML::Entities