use htmlspecialcharsex to work correctly in PHP 5.4+