UTF-8 characters in audio guide captions break across transport chunks
Level 2 · node · Data · Decoding multibyte UTF-8 characters split across chunks
Scenario
A fictional museum audio guide editor receives caption text as UTF-8 byte chunks and reconstructs a single string. The transport device can split data independently of character boundaries. English captions work, but some characters in multilingual captions become corrupted depending on chunk size.
Requirements
Return the UTF-8 string represented by the complete byte sequence formed by joining input chunks in arrival order. The complete input is valid UTF-8 and each chunk is a Buffer. Empty chunks and empty input are allowed. Do not modify the input chunks, and reconstruct each guide independently.
Acceptance criteria
- Return the original English caption including line breaks unchanged.
- Reconstruct multibyte characters accurately even when they span multiple chunks.
- Empty chunks do not affect output and empty input returns an empty string.
- Successive lookups of different guides do not mix results or alter the original bytes.