mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Simplify surrogate check in to_text() (#18211)
* Simplify surrogate check in to_text() * Simplify surrogateescape check even further
This commit is contained in:
parent
90b180c815
commit
b365f44fa1
1 changed files with 0 additions and 6 deletions
|
@ -173,12 +173,6 @@ def to_text(obj, encoding='utf-8', errors=None, nonstring='simplerepr'):
|
||||||
else:
|
else:
|
||||||
errors = 'strict'
|
errors = 'strict'
|
||||||
|
|
||||||
if errors is None:
|
|
||||||
if PY3:
|
|
||||||
errors = 'surrogateescape'
|
|
||||||
else:
|
|
||||||
errors = 'replace'
|
|
||||||
|
|
||||||
if isinstance(obj, binary_type):
|
if isinstance(obj, binary_type):
|
||||||
return obj.decode(encoding, errors)
|
return obj.decode(encoding, errors)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue