Test case for htmlentities() on UTF-8 strings.

Closes #2266