jsdom / tr46

An implementation of the Unicode UTS #46: Unicode IDNA Compatibility Processing.
MIT License
32 stars 17 forks source link

Converting https://www.xn--b.com to Punycode using toASCII() returns null. #64

Closed dkamanga-dot closed 1 month ago

dkamanga-dot commented 1 month ago

Hello. Is there a reason why converting https://www.xn--b.com to Punycode would return null? Please see the code snippet below.

Welcome to Node.js v22.9.0.
Type ".help" for more information.
> const tr46 = require('tr46');
> tr46.toASCII("https://www.xn--b.com")
null
domenic commented 1 month ago

I believe (haven't fully stepped through the code) that it's because b is not long enough to encode anything interesting in Punycode, so you get a decoding error (represented as null).