Skip to content

chore: open files with encoding=utf-8 - #194

Open
SoundMatt wants to merge 1 commit into
COVESA:mainfrom
SoundMatt:fix/spec-history-utf8-encoding
Open

chore: open files with encoding=utf-8#194
SoundMatt wants to merge 1 commit into
COVESA:mainfrom
SoundMatt:fix/spec-history-utf8-encoding

Conversation

@SoundMatt

Copy link
Copy Markdown

Three open() calls in the spec_history modules read or wrote files without specifying encoding="utf-8", falling back to Python's locale-dependent default. On Windows or systems whose default locale isn't UTF-8, GraphQL type definitions and JSON-LD spec history files containing non-ASCII characters in descriptions or comments would be silently corrupted (write side) or fail to parse (read side).

Sites fixed:

  • src/s2dm/exporters/spec_history.py:247 — type-definition write
  • src/s2dm/registry/spec_history.py:71 — JSON load
  • src/s2dm/registry/spec_history.py:80 — JSON-LD save

The other open() calls in the codebase (vspec.py, cli.py, concept_uri.py, naming_config.py, variant_ids.py) already pass encoding="utf-8" correctly. This brings the spec_history modules in line.

No behaviour change on macOS/Linux where the default locale is already UTF-8. Local verification: 532 tests pass.

@cpodalak cpodalak changed the title spec_history: open files with encoding=utf-8 chore: open files with encoding=utf-8 Jun 5, 2026
@cpodalak

Copy link
Copy Markdown
Collaborator

@SoundMatt, checks faiiling.. ⬆️

Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt force-pushed the fix/spec-history-utf8-encoding branch from 2694215 to 8014cef Compare June 15, 2026 15:08
@SoundMatt

Copy link
Copy Markdown
Author

@cpodalak — the CI hasn't run yet because this is a fork PR and needs a maintainer to click "Approve and run" on the Actions tab to trigger the workflows. The commit 8014cef has the correct fix: conventional-commit prefix so gitlint should pass this time. Could you approve the CI run?

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.

2 participants