in reply to HTTP::Response decoded_content catch 22

I think HTML::TreeBuilder only works on bytes (not characters) since it's made to work on files. I had problems getting it to work with characters and ended up decoding everything I extracted from the tree. The way to go might be
my $html_file = encode( 'ASCII', $response->decoded_content(), Encode::FB_HTMLCREF ); my $tree = HTML::TreeBuilder->new(); $tree->parse($html_file);

and use utf8::decode on everything extracted from the tree if necessary.

It has the advantage of handling multiple byte encoding if HTML::Parser doesn't, and one knows which encoding to use when decoding data extracted from the tree.