fix: replace Unicode arrow with ASCII for Windows compatibility#123
Merged
fix: replace Unicode arrow with ASCII for Windows compatibility#123
Conversation
The → character (U+2192) cannot be encoded by the Windows cp1252 codec, causing installation to fail on Windows. Replace all occurrences with the ASCII equivalent (->). Closes #122
This was referenced Apr 22, 2026
dot-cross
pushed a commit
to EpsilonForge/gsim
that referenced
this pull request
Apr 23, 2026
Adds a pre-commit hook (scripts/check_cp1252.py) that fails when a .py file contains characters not encodable in Windows cp1252. cp1252 is the default codec Windows uses when reading source/metadata during pip install, so non-cp1252 characters raise UnicodeDecodeError at install time (see gdsfactory#122, gdsfactory#123). Also fixes all existing violations so the hook passes on the current tree: - polygon_utils.py: replace left-right arrow with ASCII "<->" - palace/results.py: ASCII "---" section separators - meep/simulation.py, meep/models/api.py: replace "approx" symbol with ASCII "~="; drop subscript zero in waist symbol - meep/script.py: use micro sign (U+00B5, cp1252-safe) instead of Greek mu (U+03BC); replace sigma with "sum" - common/stack/materials.py: replace omega with "ohm" - common/stack/visualization.py: swap Unicode box-drawing chars for ASCII "+ - |" in the print_stack layer diagram. These also failed on Windows cp1252 stdout in practice.
dot-cross
pushed a commit
to EpsilonForge/gsim
that referenced
this pull request
Apr 23, 2026
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 gdsfactory#123 and gdsfactory#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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
→, U+2192) with ASCII->across source and test files→character cannot be encoded by the Windows cp1252 codec, causingUnicodeEncodeErrorduring installation on WindowsCloses #122
Test plan
pip installsucceeds on Windows