Possible encoding problem with Repository.file_status
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 1.7k
- 派生
- 408
- 平均合并
- 2 天 57 分钟
- 30 天内合并 PR
- 7
描述
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".
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用 Repository.file_status 复现 Windows Python 3.5 中路径包含 ä 和不换行空格的情况。跟踪路径经过 Repository_status_file 和 py_path_to_c_str 的过程,比较文件系统编码的输入与 UTF-8 输入;当非 ASCII 路径不再引发 KeyError 时即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- git, python
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100