Skip to content

PTY output is decoded with from_utf8_lossy per payload, so a codepoint split across frames becomes U+FFFD permanently #1155

Description

@4ndr3wxh1ll

Running at rev 8803834036205cf2cac5cfca98bb3875812c897a.

src/boxlite/src/rest/litebox.rs:708 calls String::from_utf8_lossy on each PTY payload, and ExecStdout::Item is String, so there is no carry for a partial codepoint across payload boundaries.

A multi-byte character that straddles two WebSocket frames is replaced with U+FFFD before any consumer sees it, and the original bytes are unrecoverable downstream. Box-drawing characters, braille spinners and emoji are the common casualties, which is most of a full-screen TUI redraw under load.

This matters for any consumer proxying a guest PTY to a real terminal: the corruption is silent and cannot be repaired above this layer. Buffering an incomplete trailing sequence until the next payload, or making the item type Bytes and letting the consumer decode, would both fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions