Correctly encode and decode

This commit is contained in:
Dave St.Germain
2019-08-19 16:08:38 -04:00
parent eccfeef94b
commit aaf7ddd3f3

View File

@@ -66,8 +66,9 @@ def clean_course_key(course_key, padding_char):
padding_char (str): Character used for padding at end of the encoded
string. The standard value for this is '='.
"""
encoded = b32encode(six.text_type(course_key).encode('utf8')).decode('utf8')
return "course_{}".format(
b32encode(six.text_type(course_key)).replace('=', padding_char)
encoded.replace('=', padding_char)
)