Skip to content

watch: open .gitignore files as utf-8 with permissive fallback#5102

Open
SAY-5 wants to merge 1 commit intoAider-AI:mainfrom
SAY-5:say5/load-gitignores-utf8-fallback-2888
Open

watch: open .gitignore files as utf-8 with permissive fallback#5102
SAY-5 wants to merge 1 commit intoAider-AI:mainfrom
SAY-5:say5/load-gitignores-utf8-fallback-2888

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 2, 2026

Fixes #2888.

load_gitignores opened each .gitignore with the platform default codec, which on Windows is cp1252. .gitignore files commonly contain comments or filenames in non-ASCII (or bytes from Unix tooling), so the user's traceback hits UnicodeDecodeError from cp1252.py and crashes aider on startup before the file watcher can come up. Open with encoding='utf-8' and fall back to errors='replace' if the file is genuinely not utf-8 — same shape as the existing source-file decoder in aider/io.py.

Signed-off-by: SAY-5 <say.apm35@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught UnicodeDecodeError in cp1252.py line 23

1 participant