Skip to content

Commit 0a79044

Browse files
committed
handle unicode characters gracefully in python 2
1 parent 59dd034 commit 0a79044

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/onelogin/saml2/compat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ def to_string(data):
3939

4040
def to_bytes(data):
4141
""" return bytes """
42+
if isinstance(data, unicode):
43+
return data.encode("utf8")
4244
return str(data)
4345

4446
else: # py 3.x

0 commit comments

Comments
 (0)