Skip to content

Commit

Permalink
Fix unicode errors on develop (oppia#7545)
Browse files Browse the repository at this point in the history
* Fix unicode errors on develop

* fix comment
  • Loading branch information
Rishav Chakraborty authored and aks681 committed Sep 4, 2019
1 parent 6e51a95 commit 77d6fd6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,11 @@ def convert_to_hash(input_string, max_length):
(input_string, type(input_string)))

# Encodes strings using the character set [A-Za-z0-9].
# Prefixing altchars with b' to ensure that all characters in encoded_string
# remain encoded (otherwise encoded_string would be of type unicode).
encoded_string = base64.b64encode(
hashlib.sha1(python_utils.convert_to_bytes(input_string)).digest(),
altchars='ab'
altchars=b'ab'
).replace('=', 'c')

return encoded_string[:max_length]
Expand Down

0 comments on commit 77d6fd6

Please sign in to comment.