Open this example in the interactive library
Source code
import {
URL,
domainToASCII,
domainToUnicode,
pathToFileURL,
fileURLToPath,
} from "node:url";
console.log(domainToASCII("café.example"));
Sample output
xn--caf-dma.example

Open this example in the interactive library
import {
URL,
domainToASCII,
domainToUnicode,
pathToFileURL,
fileURLToPath,
} from "node:url";
console.log(domainToASCII("café.example"));
xn--caf-dma.example