mirror of
https://github.com/python/cpython.git
synced 2025-10-17 04:08:28 +00:00
fix decoding in _stringify to not depend on the default encoding
(closes SF bug #1115989)
This commit is contained in:
parent
4380242580
commit
22c0706a58
2 changed files with 43 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue