URL

url.domainToUnicode()

Converts an ASCII domain representation into Unicode. Display labels should not be used as evidence of ownership or trust. Tested on Node.js 22.16.0. Example output (one line per entry): ["b\u00fccher.example"].

Formal Syntax & Structure

nodejs syntaxnodejs
domainToUnicode(domain)

Parameters & Attributes

NameTypeDescription
domainstringDomain name.

Return Value

string

Unicode domain or empty string.

Working Example

Example Snippetnodejs
import { domainToUnicode } from 'node:url';console.log(domainToUnicode('xn--bcher-kva.example'));
Node.js Reference