WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Requests_IDNAEncoder::to_ascii() public WP 1.0

Convert a UTF-8 string to an ASCII string using Punycode

Это метод класса: Requests_IDNAEncoder{}

Хуков нет.

Возвращает

Строку. ASCII string

Использование

$result = Requests_IDNAEncoder::to_ascii( $string );
$string(строка) (обязательный)
ASCII or UTF-8 string (max length 64 characters)

Код Requests_IDNAEncoder::to_ascii() WP 5.5.1

wp-includes/Requests/IDNAEncoder.php
<?php
public static function to_ascii($string) {
	// Step 1: Check if the string is already ASCII
	if (self::is_ascii($string)) {
		// Skip to step 7
		if (strlen($string) < 64) {
			return $string;
		}

		throw new Requests_Exception('Provided string is too long', 'idna.provided_too_long', $string);
	}

	// Step 2: nameprep
	$string = self::nameprep($string);

	// Step 3: UseSTD3ASCIIRules is false, continue
	// Step 4: Check if it's ASCII now
	if (self::is_ascii($string)) {
		// Skip to step 7
		if (strlen($string) < 64) {
			return $string;
		}

		throw new Requests_Exception('Prepared string is too long', 'idna.prepared_too_long', $string);
	}

	// Step 5: Check ACE prefix
	if (strpos($string, self::ACE_PREFIX) === 0) {
		throw new Requests_Exception('Provided string begins with ACE prefix', 'idna.provided_is_prefixed', $string);
	}

	// Step 6: Encode with Punycode
	$string = self::punycode_encode($string);

	// Step 7: Prepend ACE prefix
	$string = self::ACE_PREFIX . $string;

	// Step 8: Check size
	if (strlen($string) < 64) {
		return $string;
	}

	throw new Requests_Exception('Encoded string is too long', 'idna.encoded_too_long', $string);
}