Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeError: 'IDNA does not round-trip' #76618

Closed
socketpair mannequin opened this issue Dec 28, 2017 · 2 comments
Closed

UnicodeError: 'IDNA does not round-trip' #76618

socketpair mannequin opened this issue Dec 28, 2017 · 2 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes topic-unicode type-bug An unexpected behavior, bug, or error

Comments

@socketpair
Copy link
Mannequin

socketpair mannequin commented Dec 28, 2017

BPO 32437
Nosy @vstinner, @ezio-melotti, @asvetlov, @socketpair, @berkerpeksag
Superseder
  • bpo-17305: IDNA2008 encoding is missing
  • 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 = None
    closed_at = <Date 2017-12-28.10:19:07.562>
    created_at = <Date 2017-12-28.08:48:55.445>
    labels = ['3.8', 'type-bug', '3.7', 'expert-unicode']
    title = "UnicodeError: 'IDNA does not round-trip'"
    updated_at = <Date 2017-12-28.10:19:07.553>
    user = 'https://github.com/socketpair'

    bugs.python.org fields:

    activity = <Date 2017-12-28.10:19:07.553>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-12-28.10:19:07.562>
    closer = 'berker.peksag'
    components = ['Unicode']
    creation = <Date 2017-12-28.08:48:55.445>
    creator = 'socketpair'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32437
    keywords = []
    message_count = 2.0
    messages = ['309117', '309118']
    nosy_count = 5.0
    nosy_names = ['vstinner', 'ezio.melotti', 'asvetlov', 'socketpair', 'berker.peksag']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '17305'
    type = 'behavior'
    url = 'https://bugs.python.org/issue32437'
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @socketpair
    Copy link
    Mannequin Author

    socketpair mannequin commented 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

    @socketpair socketpair mannequin added 3.7 (EOL) end of life 3.8 only security fixes topic-unicode type-bug An unexpected behavior, bug, or error labels Dec 28, 2017
    @berkerpeksag
    Copy link
    Member

    There is an open issue about adding IDNA 2008 support: bpo-17305. Closing this one as a duplicate of that issue.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes topic-unicode type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant