fix UnicodeEncodeError when prompt is unicode.