mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-08 08:44:37 +08:00
11 lines
417 B
TypeScript
11 lines
417 B
TypeScript
const bytes = new Uint8Array([0x41]);
|
|
|
|
const runtimeLabel: string = process.argv[2] ?? "utf-8";
|
|
console.log(new TextDecoder(runtimeLabel).decode(bytes));
|
|
|
|
// WHATWG's replacement labels deliberately fail TextDecoder construction.
|
|
console.log(new TextDecoder("replacement").decode(bytes));
|
|
|
|
// Vertical tab is not WHATWG ASCII whitespace and must not be trimmed.
|
|
console.log(new TextDecoder("\vutf-8").decode(bytes));
|