Skip to content

Windows cleanup apply rejects UTF-8 BOM selection JSON #1

Description

@pomazanbohdan

Summary

apply-cleanup-selection.py rejects cleanup selection JSON files that contain a UTF-8 BOM.

Reproduction

  1. In Windows PowerShell, write a selection JSON with Set-Content -Encoding UTF8.
  2. Run python skills/maintaining-windows-health/assets/apply-cleanup-selection.py <selection.json> --dry-run.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions