Skip to content

Fix stdin UTF-8 crash on multi-byte input#29

Merged
IreneXY merged 1 commit intomainfrom
040301
Apr 4, 2026
Merged

Fix stdin UTF-8 crash on multi-byte input#29
IreneXY merged 1 commit intomainfrom
040301

Conversation

@IreneXY
Copy link
Copy Markdown
Member

@IreneXY IreneXY commented Apr 4, 2026

Summary

  • Fix FormatException: Missing extension byte crash when typing Chinese (or other multi-byte UTF-8) characters in the CLI
  • Root cause: stdin.transform(utf8.decoder) uses allowMalformed: false by default; terminal byte chunks can split mid-character
  • Fix: use Utf8Decoder(allowMalformed: true) for stdin stream

Test plan

  • dart analyze passes
  • dart format --set-exit-if-changed . passes
  • dart test passes
  • Manual test: type Chinese input (e.g. 请查询北京的天气) — no crash

🤖 Generated with Claude Code

Co-Authored-By: Claude Code noreply@anthropic.com

@IreneXY IreneXY merged commit c2a5fbf into main Apr 4, 2026
1 check passed
@IreneXY IreneXY deleted the 040301 branch April 4, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants