Skip to content

fix: force utf-8 on write_text so Windows cp1252 doesn't break output#127

Merged
vvahidd merged 1 commit intomainfrom
fix/write-text-utf8
Apr 23, 2026
Merged

fix: force utf-8 on write_text so Windows cp1252 doesn't break output#127
vvahidd merged 1 commit intomainfrom
fix/write-text-utf8

Conversation

@vvahidd
Copy link
Copy Markdown
Contributor

@vvahidd vvahidd commented Apr 23, 2026

Summary

  • Three Path.write_text(...) call sites were missing encoding=, defaulting to the host codec — cp1252 on Windows — and raising UnicodeEncodeError when the payload contained non-cp1252 chars. This is what causes the runtime failure reported for sim.run()upload()write_config().
  • Fixed sites:
    • src/gsim/meep/simulation.py:815 — generated run_meep.py
    • src/gsim/meep/models/config.py:415sim_config.json
    • src/gsim/common/stack/extractor.py:320 — stack YAML (uses allow_unicode=True, so this was the most exposed)
  • Runtime counterpart to the install-time cp1252 cleanup in fix: replace Unicode arrow with ASCII for Windows compatibility #123 and fix: enforce cp1252 compatibility in Python sources #125: those scrubbed the source chars, this makes the output codec independent of the host locale so a future edit can't silently reintroduce the bug.

Path.write_text() without an explicit encoding uses the platform's
default codec — cp1252 on Windows — and raises UnicodeEncodeError when
the payload contains any non-cp1252 character. This is the runtime
counterpart to the install-time cp1252 work in #123 and #125: cleaning
the source chars fixes today's symptom, but a future edit can
reintroduce the bug. Explicit encoding='utf-8' on the three call sites
makes the output codec independent of the host locale.
@github-actions github-actions Bot added the bug Something isn't working label Apr 23, 2026
@vvahidd vvahidd merged commit 4382ea9 into main Apr 23, 2026
8 checks passed
@vvahidd vvahidd deleted the fix/write-text-utf8 branch April 23, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant