From 9bd2b50cd7254b94848b98d990ca0b30612c7141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20D=C3=B6rwald?= Date: Thu, 31 Mar 2005 14:16:30 +0000 Subject: Backport checkin: 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 | 4 ++-- Misc/NEWS | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/command/register.py b/Lib/distutils/command/register.py index 8104ce0..135c215 100644 --- a/Lib/distutils/command/register.py +++ b/Lib/distutils/command/register.py @@ -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) diff --git a/Misc/NEWS b/Misc/NEWS index 0f7dfed..6ed345e 100644 --- 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? ================================= -- cgit v0.12