Skip to main content
toASCII - node__punycode.d.ts - Node documentation
function toASCII

Usage in Deno

```typescript import { toASCII } from "node:node__punycode.d.ts"; ```
toASCII(domain: string): string
The `punycode.toASCII()` method converts a Unicode string representing an Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the domain name will be converted. Calling `punycode.toASCII()` on a string that already only contains ASCII characters will have no effect. ```js // encode domain names punycode.toASCII('mañana.com'); // 'xn--maana-pta.com' punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com' punycode.toASCII('example.com'); // 'example.com' ```

Parameters

domain: string

Return Type

string