class DnsIdnService (View source)

Service for IDN (Internationalized Domain Name) handling

Constants

private DOMAIN_CONTENT_TYPES

private COMPOUND_CONTENT_TYPES

Methods

static string
toDisplay(string $domainName)

Human-readable form of a zone name: punycode decoded, anything else unchanged.

static string
toIdnAlias(string|null $domainName)

UTF-8 alias to show alongside a punycode zone name. Returns an empty string when the name is not punycode, or when the zone name is unknown.

static string
toUtf8(string $domainName)

No description

static string
toPunycode(string $domainName)

Convert a domain name to its Punycode representation

static bool
isIdn(string $domainName)

Check if a domain name is an IDN

static string
convertContentToPunycode(string $type, string $content)

Convert domain names in record content to punycode based on record type

static string
getFirstLetter(string $domainName)

Get the first letter of a domain name in UTF-8 format

Details

static string toDisplay(string $domainName)

Human-readable form of a zone name: punycode decoded, anything else unchanged.

Parameters

string $domainName

Return Value

string

static string toIdnAlias(string|null $domainName)

UTF-8 alias to show alongside a punycode zone name. Returns an empty string when the name is not punycode, or when the zone name is unknown.

Parameters

string|null $domainName

Return Value

string

static string toUtf8(string $domainName)

No description

Parameters

string $domainName

Return Value

string

static string toPunycode(string $domainName)

Convert a domain name to its Punycode representation

Parameters

string $domainName

The domain name to convert (can be IDN UTF-8 or punycode)

Return Value

string

The domain name in Punycode format

static bool isIdn(string $domainName)

Check if a domain name is an IDN

Parameters

string $domainName

The domain name to check

Return Value

bool

True if domain is an IDN

static string convertContentToPunycode(string $type, string $content)

Convert domain names in record content to punycode based on record type

Parameters

string $type

DNS record type

string $content

Record content

Return Value

string

Content with domain names converted to punycode

static string getFirstLetter(string $domainName)

Get the first letter of a domain name in UTF-8 format

Parameters

string $domainName

The domain name to get the first letter from

Return Value

string

The first letter of the domain in UTF-8 format