mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
change file content encoding to support unicode(like chinese), py2
This commit is contained in:
@@ -1269,6 +1269,8 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
if atLeastPython3:
|
||||
content = b64encode(content.encode('utf-8')).decode('utf-8')
|
||||
else:
|
||||
if isinstance(content, unicode):
|
||||
content = content.encode('utf-8')
|
||||
content = b64encode(content)
|
||||
put_parameters = {'message': message, 'content': content}
|
||||
|
||||
@@ -1324,6 +1326,8 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
if atLeastPython3:
|
||||
content = b64encode(content.encode('utf-8')).decode('utf-8')
|
||||
else:
|
||||
if isinstance(content, unicode):
|
||||
content = content.encode('utf-8')
|
||||
content = b64encode(content)
|
||||
|
||||
put_parameters = {'message': message, 'content': content,
|
||||
|
||||
Reference in New Issue
Block a user