5 use DOM::Tiny::Entities qw(html_escape html_unescape);
9 is html_unescape('<foo>bar<baz>&"'),
10 "<foo>bar<baz>&\"", 'right HTML unescaped result';
12 # html_unescape (special entities)
13 is html_unescape('foo ☃ ∳ bar ¹baz'),
14 "foo ☃ \x{2233} bar ¹baz", 'right HTML unescaped result';
16 # html_unescape (multi-character entity)
17 is html_unescape(decode 'UTF-8', '∾̳'), "\x{223e}\x{0333}",
18 'right HTML unescaped result';
20 # html_unescape (apos)
21 is html_unescape('foobar'<baz>&"'), "foobar'<baz>&\"",
22 'right HTML unescaped result';
24 # html_unescape (nothing to unescape)
25 is html_unescape('foobar'), 'foobar', 'right HTML unescaped result';
27 # html_unescape (UTF-8)
28 is html_unescape(decode 'UTF-8', 'foo<baz>&"Œ&Foo;'),
29 "foo<baz>&\"\x{152}&Foo;", 'right HTML unescaped result';
32 is html_escape(qq{la<f>\nbar"baz"'yada\n'<la}),
33 "la<f>\nbar"baz"'yada\n'&lt;la",
34 'right HTML escaped result';
36 # html_escape (UTF-8 with nothing to escape)
37 is html_escape('привет'), 'привет', 'right HTML escaped result';
40 is html_escape('привет<foo>'), 'привет<foo>',
41 'right HTML escaped result';