Skip to content

fix: decode feature.json as UTF-8 in Windows PowerShell - #4359

Open
hamedrabah wants to merge 2 commits into
github:mainfrom
hamedrabah:fix/4333-powershell-utf8-json
Open

fix: decode feature.json as UTF-8 in Windows PowerShell#4359
hamedrabah wants to merge 2 commits into
github:mainfrom
hamedrabah:fix/4333-powershell-utf8-json

Conversation

@hamedrabah

Copy link
Copy Markdown

Description

Fixes #4333.

Windows PowerShell 5.1 decodes Get-Content -Raw with the active ANSI code page, so a BOM-less UTF-8 feature.json can corrupt non-ASCII feature paths before JSON parsing. Read both existing feature.json paths with System.IO.File.ReadAllText(..., Encoding.UTF8) instead.

The regression writes a BOM-less UTF-8 feature directory containing Chinese characters, invokes Get-FeaturePathsEnv under Windows PowerShell 5.1, and verifies the exact resolved path.

Testing

  • Tested locally with uv run specify --help
  • Ran existing tests with uv sync && uv run pytest
  • Tested with a sample project (if applicable)

Additional checks:

  • python3 -m py_compile tests/test_check_prerequisites_paths_only.py
  • git diff --check
  • The Windows-only regression is skipped on macOS. uv sync could not complete because the configured package registry was unreachable, so CI still needs to execute the test on Windows PowerShell 5.1.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (describe below)

Codex (GPT-5, autonomous) assisted with issue investigation, implementation, test design, and review. The resulting diff and repository requirements were manually reviewed before submission.

Assisted-by: Codex (model: GPT-5, autonomous)
Copilot AI balanced review requested due to automatic review settings August 28, 2026 00:45
@hamedrabah
hamedrabah requested a review from mnriem as a code owner August 28, 2026 00:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes UTF-8 decoding of feature.json in Windows PowerShell 5.1.

Changes:

  • Reads existing feature configuration explicitly as UTF-8.
  • Adds a Windows PowerShell regression test for Unicode paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
scripts/powershell/common.ps1 Uses UTF-8 decoding for both feature JSON reads.
tests/test_check_prerequisites_paths_only.py Adds the Unicode-path regression test.

馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/test_check_prerequisites_paths_only.py
Copilot AI review requested due to automatic review settings August 28, 2026 00:54
Assisted-by: Codex (model: GPT-5, autonomous)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

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]: PowerShell 5.1 Get-Content misreads UTF-8 feature.json; setup-plan.ps1 creates a second garbled specs/ directory

2 participants