use HTML::Entities; my $crazyhtml = "

asdf ".chr(243)." asdf

"; die encode_entities($crazyhtml, "[^><]" ); __END__

asdf ¡Ü asdf

at - line 3.