Skip to content

v0.8.21 — --stdin UTF-8 fix on Windows console

Choose a tag to compare

@activeing123 activeing123 released this 17 Oct 07:01
· 65 commits to main since this release

Fixed

  • mcptoon call … --stdin no longer corrupts non-ASCII arguments on a Windows
    console.
    sys.stdin is bound to the active code page (cp936 on a Chinese UI,
    cp1252 elsewhere), so a UTF-8 JSON payload piped into --stdin was re-decoded
    through the wrong codec and sent to the server as mojibake — with no error, because
    the corrupted text is still valid JSON and json.loads accepts it. Both --stdin
    readers in _cmd_call now read sys.stdin.buffer and decode UTF-8 first, falling
    back to the stream's own encoding so a legacy console-piped payload still arrives
    unchanged. Reported and fixed by @GIGIGIGIbaby (#28).