Skip to main content
domainToUnicode - url - Node documentation
function domainToUnicode

Usage in Deno

import { domainToUnicode } from "node:url";
domainToUnicode(domain: string): string

Returns the Unicode serialization of the domain. If domain is an invalid domain, the empty string is returned.

It performs the inverse operation to domainToASCII.

import url from 'node:url';

console.log(url.domainToUnicode('xn--espaol-zwa.com'));
// Prints español.com
console.log(url.domainToUnicode('xn--fiq228c.com'));
// Prints 中文.com
console.log(url.domainToUnicode('xn--iñvalid.com'));
// Prints an empty string

Parameters

domain: string

Return Type

string