Methods
-
dec
Returns domain name written in a national alphabet, for specified Punycode string.
-
enc
Returns Punycode version of a domain name written in a national alphabet.
-
encode_uri
Returns URI written in a national alphabet, with a domain name encoded to Punycode.
public static function dec ($str)
Returns domain name written in a national alphabet, for specified Punycode string.
Parameters
-
$str
Punycode version of a domain name.
Example
waIdna::dec('xn--d1acklchcc.xn--p1ai');
Result
мойдомен.рф
public static function enc ($str)
Returns Punycode version of a domain name written in a national alphabet.
Parameters
-
$str
Domain name written in a national alphabet.
Example
waIdna::enc('мойдомен.рф');
Result
xn--d1acklchcc.xn--p1ai
public function encode_uri ($uri)
Returns a URI written in a national alphabet, with a domain name encoded to Punycode. Other parts of a URI, except for a domain name, are not encoded to Punycode. A URI must contain a domain name.
Parameters
-
$uri
URI written in a national alphabet.
Example
$idna = new waIdna(); $idna->encode_uri('https://мойдомен.рф/вакансии/');
Result
https://xn--d1acklchcc.xn--p1ai/вакансии/