UTF-8 Encoding htmlentities

Default value for htmlentities encoding is ISO-8859-1 in versions of PHP prior to 5.4.0. This will break json_encode, if you use UTF-8 characters.