Returns the Unicode serialization of the domain. If domain is an invalid domain, the empty string is returned.
domain
It performs the inverse operation to domainToASCII.
import url from 'node:url';console.log(url.domainToUnicode('xn--espaol-zwa.com'));// Prints español.comconsole.log(url.domainToUnicode('xn--fiq228c.com'));// Prints 中文.comconsole.log(url.domainToUnicode('xn--iñvalid.com'));// Prints an empty string Copy
import url from 'node:url';console.log(url.domainToUnicode('xn--espaol-zwa.com'));// Prints español.comconsole.log(url.domainToUnicode('xn--fiq228c.com'));// Prints 中文.comconsole.log(url.domainToUnicode('xn--iñvalid.com'));// Prints an empty string
v7.4.0, v6.13.0
Returns the Unicode serialization of the
domain
. Ifdomain
is an invalid domain, the empty string is returned.It performs the inverse operation to domainToASCII.