Merge pull request #1246 from kinvolk/dongsu/ca-certificates-utf8

app-misc/ca-certificates: consider system encoding when opening file
This commit is contained in:
Dongsu Park 2021-09-03 11:44:27 +02:00 committed by GitHub
commit 4fb2be88fb
2 changed files with 2 additions and 1 deletions

View File

@ -124,7 +124,8 @@ for obj in objects:
fname = fname.encode('latin1').decode('unicode_escape').encode('latin1').decode('utf8')
except (UnicodeEncodeError, UnicodeDecodeError):
pass
f = open(fname, 'w')
f = open(fname.encode(encoding=sys.getfilesystemencoding(), errors="ignore"), 'w')
f.write("-----BEGIN CERTIFICATE-----\n")
# obj['CKA_VALUE'] is a string of octals like '\060\311…',
# with a number not greater than octal 377 (which is 255,