Skip to content

Commit e188936

Browse files
authored
Merge pull request #317 from ananduri9/fix-py2-to-bytes-unicode
Handle unicode characters gracefully in python 2
2 parents fad0a9c + 0a79044 commit e188936

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
@@ -37,6 +37,8 @@ def to_string(data):
3737

3838
def to_bytes(data):
3939
""" return bytes """
40+
if isinstance(data, unicode):
41+
return data.encode("utf8")
4042
return str(data)
4143

4244
else: # py 3.x

0 commit comments

Comments
 (0)