Fix a bug in to_str() that caused it to not actually try alternative encodings when converting.
This commit is contained in:
parent
8b6891428f
commit
9da1051f83
1 changed files with 1 additions and 1 deletions
|
|
@ -636,7 +636,7 @@ def to_str(obj, encoding='utf-8', force_string=False):
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
for alt_encoding in ENCODINGS:
|
for alt_encoding in ENCODINGS:
|
||||||
try:
|
try:
|
||||||
obj = obj.encode(encoding)
|
obj = obj.encode(alt_encoding)
|
||||||
return obj
|
return obj
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue