Title: UnicodeError: 'IDNA does not round-trip'
Type: behavior Stage: resolved
Components: Unicode Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.5
Status: closed Resolution: duplicate
Dependencies: Superseder: IDNA2008 encoding is missing
View: 17305
Assigned To: Nosy List: asvetlov, berker.peksag, ezio.melotti, socketpair, vstinner
Priority: normal Keywords:

Created on 2017-12-28 08:48 by socketpair, last changed 2017-12-28 10:19 by berker.peksag. This issue is now closed.

Messages (2)
msg309117 - (view) Author: Марк Коренберг (socketpair) * Date: 2017-12-28 08:48
First: This is the bug:

In [1]: 'großhandel-shop'.encode('idna')
Out[1]: b'grosshandel-shop'

This lead to this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/encodings/", line 214, in decode
  File "/usr/lib/python3.6/encodings/", line 139, in ToUnicode
    raise UnicodeError("IDNA does not round-trip", label, label2)
UnicodeError: ('IDNA does not round-trip', b'xn--einla-pqa', b'einlass')

xn--grohandel-shop-2fb has been correctly encoded by IDNA 2008 (which is correct in Germany/DENIC since a while). Your Python very likely tries to decode it using the old IDNA 2003, which doesn't know 'ß'. see
msg309118 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-12-28 10:19
There is an open issue about adding IDNA 2008 support: Issue 17305. Closing this one as a duplicate of that issue.
Date User Action Args
2017-12-28 10:19:07berker.peksagsetstatus: open -> closed

superseder: IDNA2008 encoding is missing

nosy: + berker.peksag
messages: + msg309118
resolution: duplicate
stage: resolved
2017-12-28 09:36:21asvetlovsetnosy: + asvetlov
2017-12-28 08:48:55socketpaircreate