]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport checkin:
authorWalter Dörwald <walter@livinglogic.de>
Thu, 31 Mar 2005 14:16:30 +0000 (14:16 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Thu, 31 Mar 2005 14:16:30 +0000 (14:16 +0000)
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.

Lib/distutils/command/register.py
Misc/NEWS

index 8104ce06560bde48704409cffd45a0d8afe12a73..135c215b0e696ff37059f461276ccfa746e6ea31 100644 (file)
@@ -248,7 +248,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")
@@ -261,7 +261,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)
index 0f7dfed1d614b26026c031d29a121d79dd5bc2ee..6ed345ed585db4ec31ad274dab4aea07e036470f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -23,6 +23,12 @@ Extension Modules
 
 - weakref proxy has incorrect __nonzero__ behavior.  SF bug #1770766.
 
+Library
+-------
+
+- distutils.commands.register now encodes the data as UTF-8 before posting
+  them to PyPI.
+
 
 What's New in Python 2.4.1 final?
 =================================