Skip to content

fix(io): force UTF-8 on stdout/stderr and candidate writes#1

Open
diazMelgarejo wants to merge 1 commit into
atomic-01-episodic-mirror-fixfrom
atomic-02-utf8-encoding-fixes
Open

fix(io): force UTF-8 on stdout/stderr and candidate writes#1
diazMelgarejo wants to merge 1 commit into
atomic-01-episodic-mirror-fixfrom
atomic-02-utf8-encoding-fixes

Conversation

@diazMelgarejo

@diazMelgarejo diazMelgarejo commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Atomic PR 02 of 3

Summary

Two related Windows-compatibility fixes in .agent/tools/learn.py:

  • Reconfigure stdout/stderr to UTF-8 (errors=replace) at import, so a lesson claim containing non-ASCII text doesn't raise UnicodeEncodeError under a cp1252 console on Windows.
  • Write the candidate JSON with explicit encoding="utf-8" rather than the platform default, so candidates round-trip identically across OSes.

Both are additive and safe (the stdout reconfigure is guarded by hasattr, a no-op where unavailable).

Verification

Applied cleanly on top of #1 (this branch is based on atomic-01-episodic-mirror-fix), syntax-checked. Found and applied downstream in Perpetua-Tools; contributing back.

Stack

2 of 3 in a small related set — based on 1 of 3, # 3 will be based on this. See 1's description (codejunkie99#57) for the full context; each stands on its own merit.

Two related Windows-compatibility fixes:

- Reconfigure stdout/stderr to UTF-8 (errors=replace) at import, so a lesson
  claim containing non-ASCII (arrows, em-dashes, accented text) doesn't raise
  UnicodeEncodeError under a cp1252 console on Windows.
- Write the candidate JSON file with explicit encoding="utf-8" rather than
  the platform default, so candidates round-trip identically across OSes.

Both are additive and platform-safe (the reconfigure is guarded by hasattr,
a no-op where unavailable). Found and applied downstream in Perpetua-Tools;
contributing back.

Stacked on top of the episodic-mirror fix (atomic-01).
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.

1 participant