mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Since PyPI only accepts UTF-8 encoded data now, make sure that the data is
properly encoded and include the encoding in the Content-Type header.
This commit is contained in:
parent
b330adf9eb
commit
a6e8a4ad12
2 changed files with 5 additions and 2 deletions
|
@ -254,7 +254,7 @@ Your selection [default 1]: ''',
|
|||
if type(value) != type([]):
|
||||
value = [value]
|
||||
for value in value:
|
||||
value = str(value)
|
||||
value = unicode(value).encode("utf-8")
|
||||
body.write(sep_boundary)
|
||||
body.write('\nContent-Disposition: form-data; name="%s"'%key)
|
||||
body.write("\n\n")
|
||||
|
@ -267,7 +267,7 @@ Your selection [default 1]: ''',
|
|||
|
||||
# build the Request
|
||||
headers = {
|
||||
'Content-type': 'multipart/form-data; boundary=%s'%boundary,
|
||||
'Content-type': 'multipart/form-data; boundary=%s; charset=utf-8'%boundary,
|
||||
'Content-length': str(len(body))
|
||||
}
|
||||
req = urllib2.Request(self.repository, body, headers)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue