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
Consider the following url which has non-ascii characters: https://饾殟饾殥饾殰饾殞饾殬饾殯饾殟.gg
While trying to parse this for the hostname, both nodejs and chrome return ascii string discord.gg but corejs returns xn--ci2hbbs5ase.gg
Here is the code:
importconfiguratorfrom'core-js-pure/configurator.js';configurator({// By default polyfills are not used if they are available natively.usePolyfill: ['URL'],// Override that behaviour for URL.});importURLfrom'core-js-pure/web/url.js';// For URLconsturl=newURL('https://饾殟饾殥饾殰饾殞饾殬饾殯饾殟.gg');console.log(url.hostname);
The text was updated successfully, but these errors were encountered:
I don't know if it would be useful (as it is written in C++), but Node.js recently switched to ada for URL parsing, and this uses idna for converting between unicode and ascii.
Maybe some inspiration could be taken from their utf32_to_punycode implementation, which seems relatively short and free of dependencies (though obviously JS doesn't start from UTF32).
Consider the following url which has non-ascii characters:
https://饾殟饾殥饾殰饾殞饾殬饾殯饾殟.gg
While trying to parse this for the hostname, both nodejs and chrome return ascii string
discord.gg
but corejs returnsxn--ci2hbbs5ase.gg
Here is the code:
The text was updated successfully, but these errors were encountered: