I'm trying to use TextEncoder in Apps Script:
const textEncoder = new TextEncoder("utf-8");
let str = "test";
alert(textEncoder.encode(str));
But I'm getting this error:
ReferenceError: TextEncoder is not defined
I guess it's not supported by Apps Script. Is there a way to use TextEncoder in Apps Script (maybe I'm missing a reference), or a 'long way' of doing the code above using other JS or Apps Script commands?