fix UnicodeEncodeError when saving html