Fix #21185: Added tests for unescape_entities.

Also fixed a py3 incompatibility.
Thanks to brutasse for the report.