Fix #872: use unicode.encode('ascii', 'replace') to "handle" non-ascii characters