Set UTF-8 encoding for 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.
Merge pull request #13 from mellors/master

UTF-8 Encoding htmlentities