Skip to content

fix: UTF-8-safe mapper handoff --json on Windows - #581

Merged
wesleysimplicio merged 1 commit into
mainfrom
fix-580-handoff-utf8
Aug 14, 2026
Merged

fix: UTF-8-safe mapper handoff --json on Windows#581
wesleysimplicio merged 1 commit into
mainfrom
fix-580-handoff-utf8

Conversation

@wesleysimplicio

Copy link
Copy Markdown
Owner

Summary

simplicio-mapper handoff --json crashed on Windows cp1252 when the context pack contained .

Change

_print_json_utf8 writes the compact JSON payload as UTF-8 bytes through sys.stdout.buffer, bypassing the console codec. Callers no longer need PYTHONIOENCODING=utf-8.

Tests

tests/python/test_handoff_utf8_stdout.py

  • proves cp1252 cannot encode the arrow
  • proves the helper writes the arrow via the binary buffer
  • proves the no-buffer fallback still emits valid JSON

python -m pytest tests/python/test_handoff_utf8_stdout.py -q → 3 passed

Closes #580

print(json.dumps(..., ensure_ascii=False)) encodes through the
console code page. On cp1252 that raises UnicodeEncodeError for
ordinary arrows such as U+2192 and Loop treats a valid pack as
mapper failure.

Write the JSON via sys.stdout.buffer as UTF-8 so handoff --json
succeeds whenever the payload is valid.

Closes #580
@wesleysimplicio
wesleysimplicio merged commit 3d38608 into main Aug 14, 2026
1 check failed
@wesleysimplicio
wesleysimplicio deleted the fix-580-handoff-utf8 branch August 14, 2026 04:26
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Simplicio - Mapper Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: Windows mapper handoff --json crashes on Unicode output under cp1252

1 participant