Dev Helpers
← Back

Decode UTF-8 split across byte chunks

Decode UTF-8 split across byte chunks in JavaScript.

Open this example in the interactive library

Source code

const bytes = new TextEncoder().encode("é");
const decoder = new TextDecoder();
console.log(
  decoder.decode(bytes.slice(0, 1), { stream: true }) +
    decoder.decode(bytes.slice(1)),
);

Sample output

é