Added support for astral characters to charcode ops

This commit is contained in:
n1474335 2017-06-19 15:40:36 +00:00
parent 6d2e2259db
commit 15b83072bb
4 changed files with 45 additions and 11 deletions

View file

@ -108,8 +108,9 @@ const ByteRepr = {
throw "Error: Base argument must be between 2 and 36";
}
for (let i = 0; i < input.length; i++) {
ordinal = Utils.ord(input[i]);
const charcode = Utils.strToCharcode(input);
for (let i = 0; i < charcode.length; i++) {
ordinal = charcode[i];
if (base === 16) {
if (ordinal < 256) padding = 2;