<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/k1EfqBfik" -->

---
title: Why streamed LLM text sometimes shows “�” (and 9 other...
description: Streaming LLM text chunk-by-chunk and decoding each chunk independently with TextDecoder can corrupt multi-byte UTF-8 characters like emoji or Hindi text,...
canonical: https://daily.dev/posts/why-streamed-llm-text-sometimes-shows-and-9-other-ai-interview-questions-for-frontend-devs--k1efqbfik
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Why streamed LLM text sometimes shows “�” (and 9 other AI interview questions for frontend devs) | daily.dev
og:description: Streaming LLM text chunk-by-chunk and decoding each chunk independently with TextDecoder can corrupt multi-byte UTF-8 characters like emoji or Hindi text,...
og:url: https://daily.dev/posts/why-streamed-llm-text-sometimes-shows-and-9-other-ai-interview-questions-for-frontend-devs--k1efqbfik
og:image: https://api.daily.dev/og/posts/k1EfqBfik.png
og:image:alt: Why streamed LLM text sometimes shows “�” (and 9 other AI interview questions for frontend devs)
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Why streamed LLM text sometimes shows “�” (and 9 other AI interview questions for frontend devs)

**[Ghazi Khan](https://daily.dev/sources/pvpxyovlk)** · [@ghazikhandev](https://daily.dev/ghazikhandev) · 1 min read · 1 upvotes · 0 comments

## Summary

Streaming LLM text chunk-by-chunk and decoding each chunk independently with TextDecoder can corrupt multi-byte UTF-8 characters like emoji or Hindi text, producing the “�” replacement character when a network split lands mid-character. The fix is to use a single decoder instance for the whole stream with decode(chunk, { stream: true }) and a final flush call. This explanation is part of a free weekly series of AI interview questions for frontend developers covering LLM basics and streaming techniques (SSE vs WebSockets, ReadableStream, AbortController, proxying streams through Node), each with code, tradeoffs, and common candidate mistakes.

## Content

If you stream LLM responses and decode each chunk with `new TextDecoder().decode(chunk)`, multi-byte characters will eventually break. Hindi text, emoji and accented letters take 2 to 4 bytes in UTF-8. The network can split a chunk in the middle of one, and you get “�”. The fix is one decoder for the whole stream, `decode(chunk, { stream: true })`, and a final flush.

I wrote this up as part of a free series of AI interview questions for frontend engineers. It covers how to build AI features with the JS, TS, React and Node you already know.

The first 10 questions are live:

- LLM basics: tokens, context windows, temperature, cost
- Streaming: SSE vs WebSockets, ReadableStream, AbortController, proxying streams through Node

Each one has a short answer, TypeScript code, a tradeoffs table and the mistakes candidates commonly make. New questions every week.

[https://iocombats.com/interview-questions/ai?utm_source=dailydev&utm_medium=social&utm_campaign=ai_for_frontend&utm_content=week1_2_launch](https://iocombats.com/interview-questions/ai?utm_source=dailydev&utm_medium=social&utm_campaign=ai_for_frontend&utm_content=week1_2_launch)

## Similar posts on daily.dev

- [Build a Streaming React Chat with Microsoft Foundry Responses](https://daily.dev/posts/build-a-streaming-react-chat-with-microsoft-foundry-responses-ivna1fo2f) · C\# Corner · 2 upvotes · 0 comments
- [LLM Streaming in the Embabel Agentic AI Framework](https://daily.dev/posts/llm-streaming-in-the-embabel-agentic-ai-framework-sucft0aas) · Baeldung · 3 upvotes · 0 comments
- [Streaming JSON in just 200 lines of JavaScript – Frontend Masters Blog](https://daily.dev/posts/streaming-json-in-just-200-lines-of-javascript-frontend-masters-blog-yyfhp6ohw) · Frontend Masters · 0 upvotes · 0 comments
- [Streaming AI Text In React Native Without The Stutter](https://daily.dev/posts/streaming-ai-text-in-react-native-without-the-stutter-utvxfyez8) · Medium · 5 upvotes · 0 comments
- [Revisiting HTML streaming for modern web performance](https://daily.dev/posts/revisiting-html-streaming-for-modern-web-performance-e7c2qz7eb) · Web Performance Calendar · 175 upvotes · 7 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#llm](https://daily.dev/tags/llm), [#interview-questions](https://daily.dev/tags/interview-questions)

[View this post on daily.dev](https://daily.dev/posts/why-streamed-llm-text-sometimes-shows-and-9-other-ai-interview-questions-for-frontend-devs--k1efqbfik)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/why-streamed-llm-text-sometimes-shows-and-9-other-ai-interview-questions-for-frontend-devs--k1efqbfik","headline":"Why streamed LLM text sometimes shows “�” (and 9 other AI interview questions for frontend devs)","text":"Streaming LLM text chunk-by-chunk and decoding each chunk independently with TextDecoder can corrupt multi-byte UTF-8 characters like emoji or Hindi text, producing the “�” replacement character when a network split lands mid-character. The fix is to use a single decoder instance for the whole stream with decode(chunk, { stream: true }) and a final flush call. This explanation is part of a free weekly series of AI interview questions for frontend developers covering LLM basics and streaming techniques (SSE vs WebSockets, ReadableStream, AbortController, proxying streams through Node), each with code, tradeoffs, and common candidate mistakes.","url":"https://daily.dev/posts/why-streamed-llm-text-sometimes-shows-and-9-other-ai-interview-questions-for-frontend-devs--k1efqbfik","datePublished":"2026-10-15T04:29:17.450Z","dateModified":"2026-10-15T04:29:33.836Z","author":{"@type":"Person","name":"Ghazi Khan","url":"https://daily.dev/ghazikhandev","image":"https://avatars.githubusercontent.com/u/24544854?v=4","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":2820}},"interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/pvpxyovlk","name":"Ghazi Khan"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Ghazi Khan","item":"https://daily.dev/sources/pvpxyovlk"},{"@type":"ListItem","position":3,"name":"Why streamed LLM text sometimes shows “�” (and 9 other AI interview questions for frontend devs)"}]}
```

