Repository navigation
Description
Bug Description
When jq is not on PATH, read_feature_json_feature_directory in scripts/bash/common.sh parses .specify/feature.json with python3 and returns the value with print(). On Windows, Python encodes a piped stdout in the ANSI code page (cp1252 on Western systems, GBK on Simplified Chinese ones), not UTF-8. A non-ASCII feature directory therefore reaches bash in that code page: specs/001-café comes back as specs/001-caf\xe9, and FEATURE_DIR, IMPL_PLAN and the other paths the bash scripts derive from it are no longer valid UTF-8.
#4780 made this reader decode feature.json as UTF-8 but left its output in the code page. The GitHub extension's copy of the reader (extensions/github/scripts/bash/resolve-tasks.sh, which says it mirrors core) prints the same way and still decodes the file with the locale encoding.
It needs a working python3 on PATH (for example from the Microsoft Store Python package; the App Execution Alias stub that Windows ships without Python fails and falls through to the grep/sed fallback, #3304) and no jq.
Steps to Reproduce
From a Spec Kit checkout in Git Bash on Windows, with a working python3 and no jq:
repo=$(mktemp -d); mkdir -p "$repo/.specify" "$repo/specs/001-café"
printf '{"feature_directory":"specs/001-café"}\n' > "$repo/.specify/feature.json"
stub=$(mktemp -d); printf '#!/bin/sh\nexit 1\n' > "$stub/jq"; chmod +x "$stub/jq" # force the python3 parser
PATH="$stub:$PATH" bash -c 'source scripts/bash/common.sh; read_feature_json_feature_directory "$1"' _ "$repo" | od -cOn Linux or macOS, prefix the last command with PYTHONIOENCODING=cp1252, the encoding a Windows pipe uses by default.
Expected Behavior
The UTF-8 bytes of specs/001-café (... c a f 303 251), as with jq or with the grep/sed fallback.
Actual Behavior
0000000 s p e c s / 0 0 1 - c a f 351
"é" arrives as the single cp1252 byte 0xE9. In a sample project (specify init --integration claude --script sh, feature 001-café created by create-new-feature.sh), setup-plan.sh --json then prints JSON that is not valid UTF-8:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9: invalid continuation byte
FEATURE_DIR":"/c/Users/.../specs/001-caf\xe9"
With a GBK stdout (PYTHONIOENCODING=gbk, as on Simplified Chinese Windows), specs/001-功能 comes back as GBK bytes, and the GitHub extension's resolve-tasks.sh --json fails with ERROR: Feature directory not found.
Specify CLI Version
1.4.6.dev0 (main at f201054)
AI Agent
Not applicable (scripts run directly)
Operating System
Windows 11 (10.0.26300), Git for Windows (GNU bash 5.3.15)
Python Version
Python 3.14.6
Error Logs
See Actual Behavior.
Additional Context
- Same family as [Bug]: PowerShell 5.1 Get-Content misreads UTF-8 feature.json; setup-plan.ps1 creates a second garbled specs/ directory #4333 (PowerShell 5.1 misreading a UTF-8
feature.json) and the recent fixes that write UTF-8 to stdout explicitly in the Python helpers (fix(scripts): emit raw UTF-8 bytes without newline mangling in resolve_template.py #5539, fix(scripts): reconfigure stdout and stderr as UTF-8 in setup_tasks.py #5555, fix(scripts): reconfigure setup_plan.py streams as UTF-8 #5569). test_bash_reads_unicode_feature_state_without_jq_under_legacy_encodingsimulates the legacy decoding but setsPYTHONIOENCODING=utf-8, so it does not cover the output side.- The other inline Python in
common.shprints only ASCII (the./-invoke separator and interpreter names). - A fix with regression tests follows in a PR.
AI Disclosure
Found, reproduced and written up by Claude Code (model: Claude Opus 5.5), running autonomously with default settings, on behalf of joshinitin2016883-sketch, who approved filing it. The agent ran the reproductions above on the reporter's Windows 11 machine; the reporter did not review this report line by line.
Activity