1
0
mirror of https://github.com/gryf/wicd.git synced 2026-03-04 23:55:46 +01:00

unicode encoded is bytes

This commit is contained in:
Guido Serra
2019-08-29 14:35:47 +02:00
parent 6888489192
commit b92d5b052e
2 changed files with 4 additions and 3 deletions

View File

@@ -476,9 +476,10 @@ def sanitize_escaped(s):
def to_unicode(x):
""" Attempts to convert a string to utf-8. """
# If this is a unicode string, encode it and return
if not isinstance(x, str):
if not isinstance(x, bytes):
return x
if isinstance(x, str):
if isinstance(x, bytes):
return x
x = sanitize_escaped(x)