This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: code that writes the PKG-INFO file doesnt handle unicode
Type: Stage:
Components: Distutils Versions: Python 2.6, Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Cannot use non-ascii letters in disutils if setuptools is used.
View: 2562
Assigned To: Nosy List: ajaksu2, doko, georg.brandl
Priority: normal Keywords:

Created on 2007-05-18 11:10 by doko, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg32043 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2007-05-18 11:10
[forwarded from http://bugs.debian.org/422604 ]

http://www.mail-archive.com/distutils-sig@python.org/msg03007.html

Analysis from Phillip J. Eby:

That's not the problem, it's that the code that writes the PKG-INFO file 
doesn't handle Unicode.  See 
distutils.dist.DistributionMetadata.write_pkg_info().  It needs to use a 
file with encoding support, if it's doing unicode

However, there's currently no standard, as far as I know, for what encoding 
the PKG-INFO file should use.  Meanwhile, the 'register' command accepts 
Unicode, but is broken in handling it.

Essentially, the problem is that Python 2.5 broke this by adding a unicode 
*requirement* to the "register" command.  Previously, register simply sent 
whatever you gave it, and the PKG-INFO writing code still 
does.  Unfortunately, this means that there is no longer any one value that 
you can use for your name that will be accepted by both "register" and 
anything that writes a PKG-INFO file.

Both register and write_pkg_info() are arguably broken here, and should be 
able to work with either strings or unicode, and degrade gracefully in the 
event of non-ASCII characters in a string.  (Because even though "register" 
is only run by the package's author, users may run other commands that 
require a PKG-INFO, so a package prepared using Python <2.5 must still be 
usable with Python 2.5 distutils, and Python <2.5 allows 8-bit maintainer 
names.)

Unfortunately, this isn't fixable until there's a new 2.5.x release.  For 
previous Python versions, both register and write_pkg_info() accepted 8-bit 
strings and passed them on as-is, so the only workaround for this issue at 
the moment is to revert to Python 2.4 or less.
msg65407 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2008-04-12 17:20
Currently tracked in #2562
msg65412 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-04-12 18:29
Closing as duplicate.
History
Date User Action Args
2022-04-11 14:56:24adminsetgithub: 44970
2008-04-12 18:29:44georg.brandlsetstatus: open -> closed
resolution: duplicate
superseder: Cannot use non-ascii letters in disutils if setuptools is used.
messages: + msg65412
nosy: + georg.brandl
2008-04-12 17:20:41ajaksu2setnosy: + ajaksu2
messages: + msg65407
versions: + Python 2.6
2007-05-18 11:10:56dokocreate