Repository: python-poetry/poetry

Issue:
'ë' in author name raise an error during `poetry install`
<!-- Checked checkbox should look like this: [x] -->
- [x] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).

- **OS version and name**: -
- **Poetry version**: 1.0.3
- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: https://gist.github.com/raphaelyancey/3d6ffeaddb75d5a96c173bab51e3688c

## Issue

```bash
$ poetry install -v

Using virtualenv: /Users/raphael/Library/Caches/pypoetry/virtualenvs/pyky040-oonWdb9N-py3.7
Installing dependencies from lock file

No dependencies to install or update

  - Skipping zipp (1.1.0) Already installed
  - Skipping importlib-metadata (1.5.0) Already installed
  - Skipping pyparsing (2.4.6) Already installed
  - Skipping six (1.14.0) Already installed
  - Skipping atomicwrites (1.3.0) Already installed
  - Skipping attrs (19.3.0) Already installed
  - Skipping colorama (0.4.3) Not needed for the current environment
  - Skipping more-itertools (8.2.0) Already installed
  - Skipping packaging (20.1) Already installed
  - Skipping pluggy (0.13.1) Already installed
  - Skipping py (1.8.1) Already installed
  - Skipping wcwidth (0.1.8) Already installed
  - Skipping pytest (4.6.9) Already installed
  - Not removing pathlib2 (2.3.5) Not currently installed

[AttributeError]
'NoneType' object has no attribute 'group'

Traceback (most recent call last):
  File "/Users/raphael/.poetry/lib/poetry/_vendor/py3.7/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/Users/raphael/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/Users/raphael/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/Users/raphael/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/Users/raphael/.poetry/lib/poetry/console/commands/install.py", line 72, in handle
    builder = EditableBuilder(self.poetry, self._env, NullIO())
  File "/Users/raphael/.poetry/lib/poetry/masonry/builders/builder.py", line 70, in __init__
    self._meta = Metadata.from_package(self._package)
  File "/Users/raphael/.poetry/lib/poetry/masonry/metadata.py", line 54, in from_package
    meta.author = package.author_name
  File "/Users/raphael/.poetry/lib/poetry/packages/package.py", line 137, in author_name
    return self._get_author()['name']
  File "/Users/raphael/.poetry/lib/poetry/packages/package.py", line 165, in _get_author
    name = m.group('name')
```

The error is gone when I replace `ë` by `e` in my name in `pyproject.toml`.


Discussion:

Resolving patch:
diff --git a/poetry/packages/package.py b/poetry/packages/package.py
--- 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")


Test patch:
diff --git a/tests/packages/test_package.py b/tests/packages/test_package.py
--- 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, "Raphaël Yancey <raphael@badfile.net>"
+    )  # 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 <raphael@badfile.net>"
+    )  # 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