added htmlentities encoder