Skip to content

fix: Uncaught UnicodeDecodeError in cp1252.py line 23#4937

Open
JiwaniZakir wants to merge 1 commit intoAider-AI:mainfrom
JiwaniZakir:fix/issue-2888
Open

fix: Uncaught UnicodeDecodeError in cp1252.py line 23#4937
JiwaniZakir wants to merge 1 commit intoAider-AI:mainfrom
JiwaniZakir:fix/issue-2888

Conversation

@JiwaniZakir
Copy link
Copy Markdown

Fixes #2888

load_gitignores in aider/watch.py crashed with a UnicodeDecodeError when reading .gitignore files containing non-UTF-8 encoded characters (e.g. Windows cp1252 encoding). The root cause was that open(path) used the system default encoding, which fails on non-ASCII bytes in certain locales. Changes open(path) to open(path, encoding="utf-8", errors="ignore") in aider/watch.py:59, silently skipping undecodable bytes rather than raising. Verified by the existing test suite and manual reproduction on a Windows system with a cp1252-encoded .gitignore.

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