Fix Message Headers for PHP 5.4.0 and later

Default charset for htmlentities changed in PHP 5.4.0 to UTF-8, which broke listing of header details containing 'invalid' characters. This fix should work for all PHP versions