Skip to content

[BUG] read decodes input as Latin-1, so non-ASCII UTF-8 lines come back garbled #255

Closed

Description

@strandly-the-agent

Checks

  • I have updated to the latest minor and patch version of Strands Shell (built from main at 5a0fa2b)
  • I have checked the documentation and this is not expected behavior
  • I have searched ./issues and there are no duplicates of my issue

Binding

Rust

Strands Shell Version

0.0.0 (built from source, main 5a0fa2b / PR #231 head d3b706c)

Language Runtime Version

Rust 1.100.0

Operating System

Linux 6.1 (aarch64)

Installation Method

built from source

Steps to Reproduce

$ strands-shell -c 'echo café | { read l; echo "[$l]"; }'
$ strands-shell -c 'echo café | while read l; do echo "[$l]"; done'

Expected Behavior

[café] for both.

Actual Behavior

[café] for both (bytes 303 203 302 251 instead of 303 251). Every non-ASCII character read by read is double-encoded, so while read loops over file names or text with accents, CJK, emoji, etc. silently corrupt the data.

Additional Context

Found while reviewing #231. src/builtins/read.rs:54 pushes each byte as a char:

line.push(byte[0] as char);

which treats the input as Latin-1.

Possible Solution

Collect the line into a Vec<u8> and convert once at the end with String::from_utf8_lossy, which matches what #231 does for captured output.

Related Issues

#207, #231

Activity

  1. added
    bug
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Fields

    Language

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions