close
Skip to content

fix(extensions): use explicit UTF-8 encoding when reading manifest YAML#2370

Open
Quratulain-bilal wants to merge 1 commit intogithub:mainfrom
Quratulain-bilal:fix/utf8-encoding-windows
Open

fix(extensions): use explicit UTF-8 encoding when reading manifest YAML#2370
Quratulain-bilal wants to merge 1 commit intogithub:mainfrom
Quratulain-bilal:fix/utf8-encoding-windows

Conversation

@Quratulain-bilal
Copy link
Copy Markdown
Contributor

Summary

Fixes #2325specify extension add crashes on Windows with UnicodeDecodeError: 'gbk' codec can't decode byte ...
when extension.yml / preset.yml contains non-ASCII content (e.g., Chinese in description).

Root cause

ExtensionManifest._load_yaml (src/specify_cli/extensions.py:142) and PresetManifest._load_yaml
(src/specify_cli/presets.py:139) call open(path, 'r') without explicit encoding. On Windows, Python uses the system
locale (GBK on Chinese Windows), which fails on UTF-8 manifests.

Fix

Add encoding='utf-8' to both open() calls — matching convention already used in integrations/catalog.py:449,
workflows/engine.py:63, and every read_text(encoding="utf-8") callsite.

Test plan

  • Manual: extension.yml with Chinese description loads on Windows
  • No behavior change on macOS/Linux (UTF-8 is already default there)
  • CI green

On Windows, Python's open() defaults to the system locale encoding
(e.g., GBK on Chinese Windows), which causes UnicodeDecodeError when
extension.yml or preset.yml contains non-ASCII content such as Chinese
characters in description fields.

Add encoding='utf-8' to ExtensionManifest._load_yaml and
PresetManifest._load_yaml so manifests are read consistently across
platforms.

Fixes github#2325
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.

[Bug]: extension.yml fails to read UTF-8 encoded Chinese content on Windows

1 participant