Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#14,837 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
tooling

Direzione di ricerca

Inizia con le tre chiamate a Path.read_text() con codifica implicita in utils/check_ai.py alle righe 50, 75 e 84, quindi esegui python utils/check_ai.py dalla radice del repository. Aggiungi un test di regressione usando una locale predefinita non UTF-8; il lavoro è completato quando il checker legge Markdown coerentemente come UTF-8 e ha esito positivo su Windows senza -X utf8.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 8b3c707ebd3ec4881f4190cf42931da07eaf3b65. 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.

Lingua principale
Python
Stelle
34.6k
Fork
7.4k
Merge medio
3g 7h
PR unite (30g)
73

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di huggingface/diffusers

Tutte le issue di huggingface/diffusers

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.