Possible encoding problem with Repository.file_status
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 408
- Avg merge
- 2d 57m
- Merged PRs (30d)
- 7
Description
If I try to get the status of a single file using Repository.file_status, I get a "KeyError" when the path contains non-ASCII characters like "ä" or "\u00A0" (non breaking space").
The problem seems to be that "Repository_status_file" uses "py_path_to_c_str" to convert the path. Which encodes the path using the Python file system encoding.
If I encode the string myself using "utf-8", it works fine.
Not sure whether this is a libgit2, pygit2 or Windows problem...
Using pygit-0.24.2 on Python 3.5, running on Windows 7.
sys.getfilesystemencoding() returns "mbcs".
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Windows Python 3.5 case with Repository.file_status for paths containing ä and a non-breaking space. Trace the path through Repository_status_file and py_path_to_c_str, comparing the filesystem-encoded and UTF-8 inputs; done means the non-ASCII path no longer raises KeyError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100