diff --git a/poetry/packages/package.py b/poetry/packages/package.py index 5b7dfea09d1..cb28ef70c7f 100644 --- a/poetry/packages/package.py +++ b/poetry/packages/package.py @@ -5,6 +5,7 @@ from contextlib import contextmanager from typing import Union +from unicodedata import normalize from warnings import warn from poetry.semver import Version @@ -160,7 +161,7 @@ def _get_author(self): # type: () -> dict if not self._authors: return {"name": None, "email": None} - m = AUTHOR_REGEX.match(self._authors[0]) + m = AUTHOR_REGEX.match(normalize("NFC", self._authors[0])) name = m.group("name") email = m.group("email") @@ -171,7 +172,7 @@ def _get_maintainer(self): # type: () -> dict if not self._maintainers: return {"name": None, "email": None} - m = AUTHOR_REGEX.match(self._maintainers[0]) + m = AUTHOR_REGEX.match(normalize("NFC", self._maintainers[0])) name = m.group("name") email = m.group("email") diff --git a/tests/packages/test_package.py b/tests/packages/test_package.py index b61de86e540..510f542f222 100644 --- a/tests/packages/test_package.py +++ b/tests/packages/test_package.py @@ -13,6 +13,18 @@ def test_package_authors(): assert package.author_name == "Sébastien Eustace" assert package.author_email == "sebastien@eustace.io" + package.authors.insert( + 0, "Raphaël Yancey " + ) # With combining diacritics (ë = e + ¨ = e\u0308) + assert package.author_name == "Raphaël Yancey" # Is normalized into \u00EB + assert package.author_email == "raphael@badfile.net" + + package.authors.insert( + 0, "Raphaël Yancey " + ) # Without (ë = \u00EB) + assert package.author_name == "Raphaël Yancey" + assert package.author_email == "raphael@badfile.net" + package.authors.insert(0, "John Doe") assert package.author_name == "John Doe" assert package.author_email is None