Prevent UnicodeEncodeError on non ascii characters in html

As per issue #24