The error "IDNA does not round-trip" means that the module gets a different result when decoding and encoding the string.
By looking at the source code for Python's IDNA module, the error "IDNA does not round-trip" is raised on line 139 if the module can't recreate the input. In the decode function the input is split by dots and every part is converted in toUnicode
. There the text is decoded, but before the result is returned it encodes the result and compares it with the input and raises the error if it isn't the same: "it doesn't round-trip" or encode(decode(text)) != text
.
In the error message you also get the two strings that it tried to compare, in the first example you get:
UnicodeError: ('IDNA does not round-trip', 'xn--grohandel-shop-2fb', 'grosshandel-shop')
You get the error because it has converted ß
in "großhandel-shop" to ss
in "grosshandel-shop". The ß
character was added to the .de
-tld late 2010, so this is a bug. Before the change ß
was supposed to be changed to ss
.
Your second example is probably corrupt, because it converts to: "đsottĤmqĐqǗoĔ⢠5"