Fix Message Headers display for PHP 5.4+

Fix Message Headrers display on Details page when using PHP 5.4.0 or later.

Default charset for htlmentities changed with some breakage.

Fix uses parameters available only in PHP 5.4.0 and later, hence the conditional test