Skip to content

Commit

Permalink
Fix rendering TextEncoder encoding error regression (withastro#7777)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Jul 24, 2023
1 parent 0c99597 commit 3567afa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-cycles-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix rendering TextEncoder encoding error regression
5 changes: 3 additions & 2 deletions packages/astro/src/runtime/server/render/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ export function chunkToByteArray(
if (ArrayBuffer.isView(chunk)) {
return chunk as Uint8Array;
} else {
// stringify chunk might return a HTMLString
return encoder.encode(stringifyChunk(result, chunk));
// `stringifyChunk` might return a HTMLString, call `.toString()` to really ensure it's a string
const stringified = stringifyChunk(result, chunk);
return encoder.encode(stringified.toString());
}
}

0 comments on commit 3567afa

Please sign in to comment.