Summary
apply-cleanup-selection.py rejects cleanup selection JSON files that contain a UTF-8 BOM.
Reproduction
- In Windows PowerShell, write a selection JSON with
Set-Content -Encoding UTF8.
- Run
python skills/maintaining-windows-health/assets/apply-cleanup-selection.py <selection.json> --dry-run.
- The script fails while parsing the JSON before validation or dry-run execution.
Actual behavior
The loader uses read_text(encoding=utf-8). A BOM is preserved and json.loads reports an unexpected UTF-8 BOM.
Expected behavior
The apply helper should accept both BOM-prefixed and BOM-less UTF-8 selection JSON.
Impact
Selection files generated or edited by Windows PowerShell cannot be previewed or applied, even when all cleanup commands are valid.
Environment
- Windows 11
- Windows PowerShell
- Python 3
Candidate fix
Read the selection with encoding=utf-8-sig and add a regression test covering BOM-prefixed JSON. A local working-tree change using utf-8-sig makes the dry-run succeed.
Summary
apply-cleanup-selection.pyrejects cleanup selection JSON files that contain a UTF-8 BOM.Reproduction
Set-Content -Encoding UTF8.python skills/maintaining-windows-health/assets/apply-cleanup-selection.py <selection.json> --dry-run.Actual behavior
The loader uses
read_text(encoding=utf-8). A BOM is preserved andjson.loadsreports an unexpected UTF-8 BOM.Expected behavior
The apply helper should accept both BOM-prefixed and BOM-less UTF-8 selection JSON.
Impact
Selection files generated or edited by Windows PowerShell cannot be previewed or applied, even when all cleanup commands are valid.
Environment
Candidate fix
Read the selection with
encoding=utf-8-sigand add a regression test covering BOM-prefixed JSON. A local working-tree change usingutf-8-sigmakes the dry-run succeed.