UTF-8 author name leads to Author-email field being encoded
See original GitHub issueI have a pyproject.toml
containing my name and email in the authors
field like this:
authors = [
{ name = "Gina Häußge", email = "gina@octoprint.org" }
]
Running python -m build
generates the following in METADATA
:
Author-email: =?utf-8?b?R2luYSBIw6R1w59nZSA8Z2luYUBvY3RvcHJpbnQub3JnPg==?=
That in turn leads to an error when attempting to upload such a package to testpypi (I haven’t yet tried production pypi but I would expect it to behave exactly the same):
❯ python -m twine upload --repository testpypi dist/*
[...]
ERROR HTTPError: 400 Bad Request from https://test.pypi.org/legacy/
'=?utf-8?b?R2luYSBIw6R1w59nZSA8Z2luYUBvY3RvcHJpbnQub3JnPg==?=' is an invalid value for Author-email. Error: Use a valid email address See https://packaging.python.org/specifications/core-metadata for more
information.
Should this maybe rather be =?utf-8?b?R2luYSBIw6R1w59nZQ==?= <gina@octoprint.org>
in that Author-email
field? Or maybe, given that Core metadata specifications says this:
Whenever metadata is serialised to a byte stream (for example, to save to a file), strings must be serialised using the UTF-8 encoding.
just leaving UTF-8 strings as is and including them in the file unencoded would be the best way, but I don’t know what side effects that might have.
In my setup.py
based packages, METADATA
looks like this and that works just fine on upload:
Author: =?utf-8?b?R2luYSBIw6R1w59nZQ==?=
Author-email: gina@octoprint.org
So, if push comes to shove, splitting the values up like this might be the easiest solution to this issue, as already mentioned in #501. Being forced to write my name ASCII only certainly feels wrong in 2022 😉
Issue Analytics
- State:
- Created 10 months ago
- Reactions:2
- Comments:6 (3 by maintainers)
No worries, happy to help 😊
Ah, thanks, yes, that
wheel
ticket looks very much like it.For reference, my build system definition:
And apologies, I’m still getting my bearings with the fancy new stuff after coming from a decade of
setup.py
😃In that case, happy to close this and sub to the
wheel
issue instead, thanks and apologies for the noise!