From b433831d7ad5491ebdfeff3ecc67b3f778c4d0da Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Sun, 8 Oct 2023 13:17:47 -0300 Subject: [PATCH] Add "utf8" as an accepted encoding for `TextDecoder` --- .changeset/chatty-zoos-eat.md | 5 +++++ packages/runtime/src/polyfills/text-decoder.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/chatty-zoos-eat.md diff --git a/.changeset/chatty-zoos-eat.md b/.changeset/chatty-zoos-eat.md new file mode 100644 index 00000000..0c7f76bd --- /dev/null +++ b/.changeset/chatty-zoos-eat.md @@ -0,0 +1,5 @@ +--- +'nxjs-runtime': patch +--- + +Add "utf8" as an accepted encoding for `TextDecoder` diff --git a/packages/runtime/src/polyfills/text-decoder.ts b/packages/runtime/src/polyfills/text-decoder.ts index 58e9d5ea..93b15c8d 100644 --- a/packages/runtime/src/polyfills/text-decoder.ts +++ b/packages/runtime/src/polyfills/text-decoder.ts @@ -20,7 +20,7 @@ export class TextDecoder implements globalThis.TextDecoder { fatal: boolean; ignoreBOM: boolean; constructor(encoding?: string) { - if (typeof encoding === 'string' && encoding !== 'utf-8') { + if (typeof encoding === 'string' && encoding !== 'utf-8' && encoding !== 'utf8') { throw new TypeError('Only "utf-8" decoding is supported'); } this.encoding = 'utf-8';