Skip to content

Commit dbfa83a

Browse files
committed
Try with replace
1 parent c541064 commit dbfa83a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pygit2/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def maybe_string(ptr):
3434
if not ptr:
3535
return None
3636

37-
return ffi.string(ptr).decode('utf8', errors='surrogateescape')
37+
return ffi.string(ptr).decode('utf8', errors='replace')
3838

3939

4040
def to_bytes(s, encoding='utf-8', errors='strict'):

test/test_nonunicode.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232

3333
bstring = b'\xc3master'
3434

35+
3536
def test_nonunicode_branchname(testrepo):
3637
folderpath = 'temp_repo_nonutf'
3738
if os.path.exists(folderpath):
3839
shutil.rmtree(folderpath)
3940
newrepo = pygit2.clone_repository(
40-
path=folderpath,
41-
url='https://github.com/pygit2/test_branch_notutf.git'
42-
)
41+
path=folderpath, url='https://github.com/pygit2/test_branch_notutf.git'
42+
)
4343
assert bstring in [
4444
(ref.split('/')[-1]).encode('utf8', 'surrogateescape')
4545
for ref in newrepo.listall_references()
46-
] # Remote branch among references: 'refs/remotes/origin/\udcc3master'
46+
] # Remote branch among references: 'refs/remotes/origin/\udcc3master'

0 commit comments

Comments
 (0)