Prevent UnicodeEncodeError on non ascii characters in html