Requests_IDNAEncoder::encode() WordPress Method

The Requests_IDNAEncoder::encode() method is used to convert a given Unicode string to an ASCII-compatible IDNA encoding. This is useful for internationalized domain names (IDNs).

Requests_IDNAEncoder::encode( string $string ) #

Encode a hostname using Punycode


Parameters

$string

(string)(Required)Hostname


Top ↑

Return

(string) Punycode-encoded hostname


Top ↑

Source

File: wp-includes/Requests/IDNAEncoder.php

	public static function encode($string) {
		$parts = explode('.', $string);
		foreach ($parts as &$part) {
			$part = self::to_ascii($part);
		}
		return implode('.', $parts);
	}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.