Add extension support for non-english names #1619
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Replace use of
btoa
with custom base 64 encoder obtained from MDN.(Note that it uses the deprecated
substr
method, I've replaced it withsubstring
which is equivalent since we start from index 0).Motivation and Context
Currently, it is generally not possible to create an extension for students with non-english names.
For reasons (see #931), we are base64 encoding student names and looking them up in a dictionary. However,
btoa
"expects to be passed binary data, and will throw an exception if the given string contains any characters whose UTF-16 representation occupies more than one byte."On the other hand, Ruby's
Base64.strict_encode64
handles it just fine. Hence this PR replaces the base64 encoding algorithm on the frontend.Closes #1466
How Has This Been Tested?
Types of changes
Checklist:
overcommit --install && overcommit --sign
to use pre-commit hook for linting