Skip to content

fix: add explicit UTF-8 encoding to file operations - #111

Open
Pawansingh3889 wants to merge 2 commits into
ThomasParistech:mainfrom
Pawansingh3889:fix/utf8-encoding-windows
Open

fix: add explicit UTF-8 encoding to file operations#111
Pawansingh3889 wants to merge 2 commits into
ThomasParistech:mainfrom
Pawansingh3889:fix/utf8-encoding-windows

Conversation

@Pawansingh3889

Copy link
Copy Markdown

On Windows, open() without encoding defaults to the system locale (e.g. cp1252), which crashes on paths or content with accented characters like é. This affects GPX files with French/German place names and SVG icons.

Changes:

  • gpx_io.py: add encoding='utf-8' to GPX file read
  • simplify_gpx.py: add encoding='utf-8' to GPX file write
  • header.py: add encoding='utf-8' to SVG file read
  • elevation_map.py: ensure cache path passed as str to rasterio

Ref #99

Description

Corresponding Github Issues / Pull Requests

Proof of Functionality

Provide evidence that the changes work as intended. Include screenshots, logs, or other relevant output.

Warning

On Windows, open() without encoding defaults to the system locale
(e.g. cp1252), which crashes on paths or content with accented
characters like é. This affects GPX files with French/German place
names and SVG icons.

Changes:
- gpx_io.py: add encoding='utf-8' to GPX file read
- simplify_gpx.py: add encoding='utf-8' to GPX file write
- header.py: add encoding='utf-8' to SVG file read
- elevation_map.py: ensure cache path passed as str to rasterio

Ref ThomasParistech#99
@github-actions github-actions Bot added the bug Something isn't working label Apr 6, 2026
@Pawansingh3889

Copy link
Copy Markdown
Author

Closing this as I tidy up my open PRs and refocus my contributions. Happy for anyone to pick it up if it's useful. Thanks!

@ThomasParistech

Copy link
Copy Markdown
Owner

@Pawansingh3889 Sorry I was busy and didn't notice your PR, I'll have a look
Thanks!

The prior run's ruff_mypy_pytest failure was https://overpass-api.de
rate-limiting the test suite's live OSM downloads (429), unrelated to
this PR's actual change. Confirmed locally: ruff, mypy, and pytest all
pass (9 failures reproduced independently, all the same 429 on
overpass-api.de, across every affected test). Empty commit to get a
fresh CI run rather than fight a months-old, expired run log.
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.

2 participants