Skip to content

utf-8 branch name issue in SymbolicReference._get_ref_info_helper #954

Closed
@grho

Description

@grho

Hi,
a branch is shown incorrectly when contains utf-8 characters

Branch name:
refs/heads/zażółć_gęślą_jaźń

The issue can be fixed by adding encoding in SymbolicReference._get_ref_info_helper.
Proposed change:
Replace

with open(osp.join(repodir, ref_path), 'rt') as fp:

Current result (e.g. shown as active_branch):
refs/heads/zażółć_gęślą_jaźń

with

with open(osp.join(repodir, ref_path), 'rt', encoding="utf-8") as fp:

Expected result:
refs/heads/zażółć_gęślą_jaźń

Activity

Byron

Byron commented on Oct 28, 2019

@Byron
Member

Thanks for letting me know! Unfortunately, GitPython is full of encoding issues, and even though assuming UTF-8 isn't technically a perfect fix, it's definitely an improvement over using ASCII implicitly.

I would be happy to receive a PR for that.

Harmon758

Harmon758 commented on Feb 18, 2020

@Harmon758
Member

Duplicate of #774

added this to the v3.0.9 - Bugfixes milestone on Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Byron@Harmon758@grho

        Issue actions

          utf-8 branch name issue in SymbolicReference._get_ref_info_helper · Issue #954 · gitpython-developers/GitPython