Skip to content

Windows: check_ai.py fails decoding UTF-8 guides with the default locale #14837

Description

@dlowzzxx

Describe the bug

The documented agent setup check crashes on Windows when Python uses the default CP1252 locale encoding. The checker reads UTF-8 Markdown with Path.read_text() without an explicit encoding.

Reproduced on Windows, CPython 3.12.14, checkout 8b3c707. utils/check_ai.py is unchanged between this checkout and my existing attention-mask branch.

Reproduction

From the repository root in an installed development environment:

python utils/check_ai.py

It exits 1 at utils/check_ai.py:50:

prose = CODE_FENCE.sub("", path.read_text())
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 7411: character maps to <undefined>

The same checkout succeeds with:

python -X utf8 utils/check_ai.py

Expected behavior and proposed scope

The check should read repository Markdown consistently as UTF-8, independent of the system locale. There are three implicit-encoding read_text() calls in this script (lines 50, 75, and 84). Proposed fix: specify encoding="utf-8" for all three and add a regression test using a non-UTF-8 default. No .ai files would change.

I can submit this focused fix if that direction is welcome. Two targeted searches for check_ai with encoding/Windows found no duplicate. Reproduction and proposed fix were investigated with AI assistance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions