in reply to HTML::Entities and UTF-8

Instead of searching for multibyte characters, you can change which characters encode_entities encodes to leave the high-bit characters. This will preserve all the UTF-8 bytes. As long as your HTML is marked as encoded with UTF-8, then the browser should display it properly.

For example, this just encoded the special characters.

$string = encode_entities($a, "<>&");