Skip to content

Punycode decoding is not working in rare cases #39397

Open
@nebulade

Description

@nebulade

Version

16.5.0

Platform

various linux distros tried

Subsystem

No response

What steps will reproduce the bug?

On some IDNs a correct punycoded domain will break url.domainToUnicode() and thus other parts within nodejs like dns.lookup() and such.

The domain in question is xn--mgba6a0dd.com which on its own as such works, however if there are subdomains with a combination of . +_ the API returns an empty string, which should not be the case from my knowledge as well as https://www.punycoder.com/ deals with all of them correctly.

To reproduce via the node repl:

> require('url').domainToUnicode('foo._bar.xn--mgba6a0dd.com')
''
> require('url').domainToUnicode('foo.bar.xn--mgba6a0dd.com')
'foo.bar.قازاق.com'
> require('url').domainToUnicode('foo_bar.xn--mgba6a0dd.com')
'foo_bar.قازاق.com'

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    dnsIssues and PRs related to the dns subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions