Skip to content

Encoding issue with GitPython and Aider Usage #2030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cvjxendra opened this issue May 28, 2025 · 2 comments
Open

Encoding issue with GitPython and Aider Usage #2030

cvjxendra opened this issue May 28, 2025 · 2 comments

Comments

@cvjxendra
Copy link

Environment:

  • OS: Windows 10.
  • Python: 3.11.9
  • Git: 2.46.1.windows.1
  • Aider v0.83.2 (this is the current version)
  • Git repository index version: 2 (verified with git update-index --show-index-version)

I’m encountering an issue when using Aider, a programming tool that relies on GitPython to interact with my Git repository. When starting Aider, I get the following error:
"Unable to read staged files: 'utf-8' codec can't decode byte 0xf5 in position 18: invalid start byte"

Because of this error, I’m forced to run Aider with the --no-git option to bypass Git integration.

My repository primarily contains legacy Delphi 7 code, with files encoded in Windows-1252.

If I understand correctly, GitPython assumes files are in UTF-8 by default, but this doesn’t match my files’ encoding. Given the legacy nature of the project and the large number of files, converting them all to UTF-8 is not a viable solution for me.

There are any solutions in this case?

Thank you.

@Byron
Copy link
Member

Byron commented May 28, 2025

One would have to find out where the decoding happens, and try to fix it.

These UTF-8 issues usually occur with filenames, but not with content of files. Maybe the conversion happens on Aider's side?

In any case, without a stack-trace, I don't think this issue is actionable, maybe to allow a surgical fix.

@cvjxendra
Copy link
Author

Yes, I have filenames that use accented characteres. Will try to produce a stack trace.

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

No branches or pull requests

2 participants