Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special characters in the changelog break installation on Python 3.X #201

Closed
jezdez opened this issue Dec 14, 2011 · 3 comments
Closed

Special characters in the changelog break installation on Python 3.X #201

jezdez opened this issue Dec 14, 2011 · 3 comments

Comments

@jezdez
Copy link
Member

jezdez commented Dec 14, 2011

See http://hudson.testrun.org/view/pytest/job/tox/TOXENV=py31,label=linux/412/console

This is probably related to an ö in the changelog.

@hpk42
Copy link

hpk42 commented Dec 14, 2011

Maybe it's just on machines where the default locale is ascii.

@kumar303
Copy link

default locale is ascii for any EN-US ubuntu install afaik :(

@carljm
Copy link

carljm commented Dec 14, 2011

Since I wasted 45 minutes on this, may as well record what I found for posterity, in case anyone else has a better solution.

This only happens on systems where the locale (and thus Python's default encoding) are ASCII. (To reproduce on Linux, export LANG=C).

The initial error is on reading from the file containing non-ASCII (docs/news.txt in our case). This part is easily fixable by switching from open(...) to codecs.open(..., encoding="UTF-8").

But then you get an encoding error on the output side. The usual way to fix this would be to explicitly encode the string to bytes in the desired encoding before output, e.g. long_description = long_description.encode("UTF-8"). We can't do that for long-description in setup.py, though, because distutils rfc822-escapes it internally, and that requires string-only methods (split). So long-description must be a string (unicode), it can't be encoded bytes.

Attempts to change the default encoding of sys.stdout are pointless, as in the installation case long-description isn't written to stdout, it's written to a file.

So I can't see any other fix here than to mangle the spelling of people's names in our changelog. Which sucks.

"Fixed" in 25ab511

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants