Skip to content

Multi-byte UTF-8 characters in tool output render as replacement characters #15385

@mfleming

Description

@mfleming

Description

Tool output with multi-byte UTF-8 characters (emdash , arrows ) shows up as in the TUI.
The bash tool and prompt.ts both assemble child process stdout with output += chunk.toString(). When a multi-byte character gets split across two data events, chunk.toString() decodes each fragment independently and produces replacement characters.
Happens intermittently — depends on whether the OS splits the stdout delivery at a byte boundary that falls inside a multi-byte character.

Plugins

No response

OpenCode version

v1.2.15

Steps to reproduce

A command whose output contains emdash or arrow characters, viewed in the TUI. Easiest to reproduce with:

python3 -c "import os,time; os.write(1, b'cleanup \xe2'); time.sleep(0.05); os.write(1, b'\x80\x94 end')"

Screenshot and/or share link

No response

Operating System

Ubuntu 24.03

Terminal

kitty

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions