]> granicus.if.org Git - python/commitdiff
Since PyPI only accepts UTF-8 encoded data now, make sure that the data is
authorWalter Dörwald <walter@livinglogic.de>
Thu, 31 Mar 2005 13:57:38 +0000 (13:57 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Thu, 31 Mar 2005 13:57:38 +0000 (13:57 +0000)
properly encoded and include the encoding in the Content-Type header.

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

index 6e9a8d42973ad396fc41cf01642718a11a25c276..dec9aa2bf21c2436b21a8145598b0e1010c5e0c0 100644 (file)
@@ -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)
index 21bcb4b6cc90aaae994047a2510ed8168b08c018..fa0b85fee547742b0a26d454f0e6598ea5f667a7 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -102,6 +102,9 @@ Library
 - distutils.commands.upload was added to support uploading distribution
   files to PyPI.
 
+- distutils.commands.register now encodes the data as UTF-8 before posting
+  them to PyPI.
+
 - decimal operator and comparison methods now return NotImplemented
   instead of raising a TypeError when interacting with other types.  This
   allows other classes to implement __radd__ style methods and have them