You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2017-12-28.10:19:07.562>created_at=<Date2017-12-28.08:48:55.445>labels= ['3.8', 'type-bug', '3.7', 'expert-unicode']
title="UnicodeError: 'IDNA does not round-trip'"updated_at=<Date2017-12-28.10:19:07.553>user='https://github.com/socketpair'
In [1]: 'großhandel-shop'.encode('idna')
Out[1]: b'grosshandel-shop'
This lead to this:
'xn--einla-pqa'.decode('idna')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/encodings/idna.py", line 214, in decode
result.append(ToUnicode(label))
File "/usr/lib/python3.6/encodings/idna.py", line 139, in ToUnicoderaiseUnicodeError("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 denic.de/en/know-how/idn-domains
Activity
socketpair commentedon Dec 28, 2017
First: This is the bug:
In [1]: 'großhandel-shop'.encode('idna')
Out[1]: b'grosshandel-shop'
This lead to this:
'xn--einla-pqa'.decode('idna') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.6/encodings/idna.py", line 214, in decode result.append(ToUnicode(label)) File "/usr/lib/python3.6/encodings/idna.py", 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')https://stackoverflow.com/questions/9806036/idna-does-not-round-trip
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 denic.de/en/know-how/idn-domains
berkerpeksag commentedon Dec 28, 2017
There is an open issue about adding IDNA 2008 support: bpo-17305. Closing this one as a duplicate of that issue.