fix decoding in _stringify to not depend on the default encoding

(closes SF bug #1115989)
This commit is contained in:
Fred Drake 2005-02-11 17:59:08 +00:00
parent 4380242580
commit 22c0706a58
2 changed files with 43 additions and 1 deletions

View file

@ -173,7 +173,7 @@ if unicode:
def _stringify(string):
# convert to 7-bit ascii if possible
try:
return str(string)
return string.encode("ascii")
except UnicodeError:
return string
else: