HTMLEntities is an Open Source Java class that contains a collection of static methods (htmlentities, unhtmlentities, ...) to convert special and extended characters into HTML entitities and vice versa.
http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=htmlentities