use strict; use warnings; use HTML::TreeBuilder; # my $decoded_html = $http_response->decoded_content(); my $decoded_html = <<"__EOI__"; Foo \xC9ric __EOI__ my $t = HTML::TreeBuilder->new(); $t->parse($decoded_html); $t->eof(); my $val = ( $t->content_list() )[1]->as_text(); binmode STDOUT, ":encoding(UTF-8)"; print(<<"__EOI__"); Foo Extracted $val __EOI__