#!/usr/bin/perl -- use Test::More tests => 1; use HTML::HTML5::Parser; use HTML::HTML5::ToText; my $input = "\r\n
\r\n\r\nnum-ent apostrophe ’
\nnum-ent double-dash –
\r\n"; my $dom = HTML::HTML5::Parser->load_html( string => \$input ); my $str = HTML::HTML5::ToText->with_traits(qw/TextFormatting ShowLinks ShowImages/)->process($dom); #~ use Data::Dump qw/ pp /; warn pp($str); #~ "\x{201C}literal smart quotes\x{201D}\n\nnum-ent apostrophe \xE2\x80\x99\n\nnum-ent double-dash \xE2\x80\x93\n"; my $expected = "\x{201C}literal smart quotes\x{201D}\n\nnum-ent apostrophe \N{U+2019}\n\nnum-ent double-dash \N{U+2013}\n"; is $str, $expected;