Skip to content

Commit

Permalink
Merge pull request #317 from ananduri9/fix-py2-to-bytes-unicode
Browse files Browse the repository at this point in the history
Handle unicode characters gracefully in python 2
  • Loading branch information
pitbulk authored Dec 27, 2022
2 parents fad0a9c + 0a79044 commit e188936
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/onelogin/saml2/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def to_string(data):

def to_bytes(data):
""" return bytes """
if isinstance(data, unicode):
return data.encode("utf8")
return str(data)

else: # py 3.x
Expand Down

0 comments on commit e188936

Please sign in to comment.