diff --git a/hyphenopoly.module.js b/hyphenopoly.module.js index ce9fd8eb..120863a2 100644 --- a/hyphenopoly.module.js +++ b/hyphenopoly.module.js @@ -15,9 +15,12 @@ * in a browser environment (e.g. browserified) */ let loader = require("fs"); +const TD = typeof TextDecoder === "undefined" + ? require("util").TextDecoder + : TextDecoder; const decode = (() => { - const utf16ledecoder = new TextDecoder("utf-16le"); + const utf16ledecoder = new TD("utf-16le"); return (ui16) => { return utf16ledecoder.decode(ui16); };