Skip to content

fix: replace Unicode arrow with ASCII for Windows compatibility#123

Merged
vvahidd merged 1 commit intomainfrom
fix/unicode-arrow-windows
Apr 22, 2026
Merged

fix: replace Unicode arrow with ASCII for Windows compatibility#123
vvahidd merged 1 commit intomainfrom
fix/unicode-arrow-windows

Conversation

@joamatab
Copy link
Copy Markdown
Contributor

Summary

  • Replace all Unicode arrow characters (, U+2192) with ASCII -> across source and test files
  • The character cannot be encoded by the Windows cp1252 codec, causing UnicodeEncodeError during installation on Windows

Closes #122

Test plan

  • All pre-commit hooks pass (ruff, codespell, ty, etc.)
  • Verify pip install succeeds on Windows

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
@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation labels Apr 22, 2026
@vvahidd vvahidd merged commit 7261aa2 into main Apr 22, 2026
7 checks passed
@vvahidd vvahidd deleted the fix/unicode-arrow-windows branch April 22, 2026 19:00
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

issues installing on windows

2 participants